소스 검색

Merge remote-tracking branch 'BabylonJS/master' into optional-dependencies

# Conflicts:
#	Viewer/webpack.gulp.config.js
Raanan Weber 7 년 전
부모
커밋
cb38d6812a
69개의 변경된 파일917692개의 추가작업 그리고 36842개의 파일을 삭제
  1. 6218 6209
      Playground/babylon.d.txt
  2. 892574 0
      Playground/scenes/dummy2.babylon
  3. 14 8
      Viewer/src/configuration/loader.ts
  4. 4 0
      Viewer/src/configuration/mappers.ts
  5. 4 0
      Viewer/src/eventManager.ts
  6. 10 3
      Viewer/src/index.ts
  7. 3 2
      Viewer/src/model/modelAnimation.ts
  8. 1 1
      Viewer/src/model/viewerModel.ts
  9. 21 1
      Viewer/src/templateManager.ts
  10. 1 1
      Viewer/src/viewer/defaultViewer.ts
  11. 47 5
      Viewer/src/viewer/viewer.ts
  12. 14 2
      Viewer/src/viewer/viewerManager.ts
  13. 3 1
      Viewer/webpack.config.js
  14. 2 1
      Viewer/webpack.gulp.config.js
  15. 3345 3340
      dist/preview release/babylon.d.ts
  16. 43 43
      dist/preview release/babylon.js
  17. 141 70
      dist/preview release/babylon.max.js
  18. 43 43
      dist/preview release/babylon.worker.js
  19. 13782 13777
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  20. 43 43
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  21. 139 70
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  22. 139 70
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  23. 141 70
      dist/preview release/es6.js
  24. 1 1
      dist/preview release/gltf2Interface/package.json
  25. 4 0
      dist/preview release/gui/babylon.gui.d.ts
  26. 50 0
      dist/preview release/gui/babylon.gui.js
  27. 3 3
      dist/preview release/gui/babylon.gui.min.js
  28. 4 0
      dist/preview release/gui/babylon.gui.module.d.ts
  29. 1 1
      dist/preview release/gui/package.json
  30. 2 2
      dist/preview release/inspector/babylon.inspector.bundle.js
  31. 1 1
      dist/preview release/inspector/package.json
  32. 4 2
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  33. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  34. 4 2
      dist/preview release/loaders/babylon.glTFFileLoader.js
  35. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  36. 4 2
      dist/preview release/loaders/babylonjs.loaders.js
  37. 1 1
      dist/preview release/loaders/babylonjs.loaders.min.js
  38. 2 2
      dist/preview release/loaders/package.json
  39. 1 1
      dist/preview release/materialsLibrary/package.json
  40. 1 1
      dist/preview release/postProcessesLibrary/package.json
  41. 1 1
      dist/preview release/proceduralTexturesLibrary/package.json
  42. 2 2
      dist/preview release/serializers/package.json
  43. 5 0
      dist/preview release/viewer/babylon.viewer.d.ts
  44. 64 69
      dist/preview release/viewer/babylon.viewer.js
  45. 549 12927
      dist/preview release/viewer/babylon.viewer.max.js
  46. 1 1
      dist/preview release/viewer/package.json
  47. 1 1
      dist/preview release/what's new.md
  48. 56 0
      gui/src/controls/container.ts
  49. 1 2
      gui/src/tsconfig.json
  50. 1 1
      loaders/src/glTF/2.0/Extensions/MSFT_lod.ts
  51. 3 1
      loaders/src/glTF/2.0/babylon.glTFLoader.ts
  52. 1 1
      package.json
  53. 4 0
      src/Animations/babylon.animatable.ts
  54. 32 20
      src/Animations/babylon.runtimeAnimation.ts
  55. 18 2
      src/Layer/babylon.effectLayer.ts
  56. 18 2
      src/Lights/Shadows/babylon.shadowGenerator.ts
  57. 1 1
      src/Mesh/babylon.abstractMesh.ts
  58. 3 1
      src/Mesh/babylon.mesh.ts
  59. 1 1
      src/Particles/EmitterTypes/babylon.coneParticleEmitter.ts
  60. 8 2
      src/Particles/babylon.gpuParticleSystem.ts
  61. 1 1
      src/Particles/babylon.particleSystem.ts
  62. 0 3
      src/PostProcess/babylon.vrDistortionCorrectionPostProcess.ts
  63. 8 2
      src/Shaders/glowMapGeneration.vertex.fx
  64. 1 1
      src/Shaders/gpuUpdateParticles.vertex.fx
  65. 8 1
      src/Shaders/shadowMap.vertex.fx
  66. 4 6
      src/Tools/babylon.promise.ts
  67. 25 11
      src/babylon.scene.ts
  68. 0 1
      src/tsconfig.json
  69. 58 0
      tests/unit/babylon/src/Tools/babylon.promise.tests.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 6218 - 6209
Playground/babylon.d.txt


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 892574 - 0
Playground/scenes/dummy2.babylon


+ 14 - 8
Viewer/src/configuration/loader.ts

@@ -11,7 +11,7 @@ export class ConfigurationLoader {
 
     private loadRequests: Array<IFileRequest>;
 
-    constructor() {
+    constructor(private _enableCache: boolean = false) {
         this.configurationCache = {};
         this.loadRequests = [];
     }
@@ -73,24 +73,30 @@ export class ConfigurationLoader {
         this.loadRequests.forEach(request => {
             request.abort();
         });
+        this.loadRequests.length = 0;
     }
 
     private loadFile(url: string): Promise<any> {
         let cacheReference = this.configurationCache;
-        if (cacheReference[url]) {
+        if (this._enableCache && cacheReference[url]) {
             return Promise.resolve(cacheReference[url]);
         }
 
         return new Promise((resolve, reject) => {
-            let fileRequest = Tools.LoadFile(url, resolve, undefined, undefined, false, (request, error: any) => {
+            let fileRequest = Tools.LoadFile(url, (result) => {
+                let idx = this.loadRequests.indexOf(fileRequest);
+                if (idx !== -1)
+                    this.loadRequests.splice(idx, 1);
+                if (this._enableCache) cacheReference[url] = result;
+                resolve(result);
+            }, undefined, undefined, false, (request, error: any) => {
+                let idx = this.loadRequests.indexOf(fileRequest);
+                if (idx !== -1)
+                    this.loadRequests.splice(idx, 1);
                 reject(error);
             });
             this.loadRequests.push(fileRequest);
         });
     }
 
-}
-
-export let configurationLoader = new ConfigurationLoader();
-
-export default configurationLoader;
+}

+ 4 - 0
Viewer/src/configuration/mappers.ts

@@ -118,6 +118,10 @@ export class MapperManager {
         this.mappers[type] = mapper;
     }
 
+    public dispose() {
+        this.mappers = {};
+    }
+
 }
 
 export let mapperManager = new MapperManager();

+ 4 - 0
Viewer/src/eventManager.ts

@@ -37,4 +37,8 @@ export class EventManager {
             callbackDef.callback(data);
         });
     }
+
+    public dispose() {
+        this.callbacksContainer = {};
+    }
 }

+ 10 - 3
Viewer/src/index.ts

@@ -22,10 +22,17 @@ import { InitTags } from './initializer';
 PromisePolyfill.Apply();
 
 export let disableInit: boolean = false;
-document.addEventListener("DOMContentLoaded", function (event) {
+document.addEventListener("DOMContentLoaded", init);
+function init(event) {
+    document.removeEventListener("DOMContentLoaded", init);
     if (disableInit) return;
     InitTags();
-});
+}
+
+function disposeAll() {
+    viewerManager.dispose();
+    mapperManager.dispose();
+}
 
 // public API for initialization
-export { InitTags, DefaultViewer, AbstractViewer, viewerManager, mapperManager };
+export { InitTags, DefaultViewer, AbstractViewer, viewerManager, mapperManager, disposeAll };

+ 3 - 2
Viewer/src/model/modelAnimation.ts

@@ -1,4 +1,4 @@
-import { AnimationGroup, Animatable, Skeleton, IDisposable } from "babylonjs";
+import { AnimationGroup, Animatable, Skeleton } from "babylonjs";
 
 export enum AnimationPlayMode {
     ONCE,
@@ -13,7 +13,7 @@ export enum AnimationState {
     ENDED
 }
 
-export interface IModelAnimation extends IDisposable {
+export interface IModelAnimation {
     readonly state: AnimationState;
     readonly name: string;
     readonly frames: number;
@@ -27,6 +27,7 @@ export interface IModelAnimation extends IDisposable {
     reset();
     restart();
     goToFrame(frameNumber: number);
+    dispose();
 }
 
 export class GroupModelAnimation implements IModelAnimation {

+ 1 - 1
Viewer/src/model/viewerModel.ts

@@ -100,7 +100,7 @@ export class ViewerModel implements IDisposable {
                 })
             } else {
                 skeletons.forEach((skeleton, idx) => {
-                    let ag = new BABYLON.AnimationGroup("animation-" + idx, this._scene);
+                    let ag = new AnimationGroup("animation-" + idx, this._scene);
                     skeleton.getAnimatables().forEach(a => {
                         if (a.animations[0]) {
                             ag.addTargetedAnimation(a.animations[0], a);

+ 21 - 1
Viewer/src/templateManager.ts

@@ -163,6 +163,8 @@ export class TemplateManager {
         Object.keys(this.templates).forEach(template => {
             this.templates[template].dispose();
         });
+        this.templates = {};
+        this.eventManager.dispose();
 
         this.onInit.clear();
         this.onAllLoaded.clear();
@@ -355,11 +357,23 @@ export class Template {
         this.onStateChange.clear();
         this.isLoaded = false;
         // remove from parent
-        this.parent.removeChild(this.fragment);
+        try {
+            this.parent.removeChild(this.fragment);
+        } catch (e) {
+            //noop
+        }
 
         this.loadRequests.forEach(request => {
             request.abort();
         });
+
+        if (this.registeredEvents) {
+            this.registeredEvents.forEach(evt => {
+                evt.htmlElement.removeEventListener(evt.eventName, evt.function);
+            });
+        }
+
+        delete this.fragment;
     }
 
     private getTemplateAsHtml(templateConfig: ITemplateConfiguration): Promise<string> {
@@ -410,7 +424,13 @@ export class Template {
 
                     // if boolean, set the parent as the event listener
                     if (typeof this._configuration.events[eventName] === 'boolean') {
+                        let binding = functionToFire.bind(this, '#' + this.parent.id);
                         this.parent.addEventListener(eventName, functionToFire.bind(this, '#' + this.parent.id), false);
+                        this.registeredEvents.push({
+                            htmlElement: this.parent,
+                            eventName: eventName,
+                            function: binding
+                        });
                     } else if (typeof this._configuration.events[eventName] === 'object') {
                         let selectorsArray: Array<string> = Object.keys(this._configuration.events[eventName] || {});
                         // strict null checl is working incorrectly, must override:

+ 1 - 1
Viewer/src/viewer/defaultViewer.ts

@@ -246,7 +246,7 @@ export class DefaultViewer extends AbstractViewer {
         super.configureLights(lightsConfiguration, model);
         // labs feature - flashlight
         if (this.configuration.lab && this.configuration.lab.flashlight) {
-            let pointerPosition = BABYLON.Vector3.Zero();
+            let pointerPosition = Vector3.Zero();
             let lightTarget;
             let angle = 0.5;
             let exponent = Math.PI / 2;

+ 47 - 5
Viewer/src/viewer/viewer.ts

@@ -1,7 +1,7 @@
 import { viewerManager } from './viewerManager';
 import { TemplateManager } from './../templateManager';
-import configurationLoader from './../configuration/loader';
-import { CubeTexture, Color3, IEnvironmentHelperOptions, EnvironmentHelper, Effect, SceneOptimizer, SceneOptimizerOptions, Observable, Engine, Scene, ArcRotateCamera, Vector3, SceneLoader, AbstractMesh, Mesh, HemisphericLight, Database, SceneLoaderProgressEvent, ISceneLoaderPlugin, ISceneLoaderPluginAsync, Quaternion, Light, ShadowLight, ShadowGenerator, Tags, AutoRotationBehavior, BouncingBehavior, FramingBehavior, Behavior } from 'babylonjs';
+import { ConfigurationLoader } from './../configuration/loader';
+import { CubeTexture, Color3, IEnvironmentHelperOptions, EnvironmentHelper, Effect, SceneOptimizer, SceneOptimizerOptions, Observable, Engine, Scene, ArcRotateCamera, Vector3, SceneLoader, AbstractMesh, Mesh, HemisphericLight, Database, SceneLoaderProgressEvent, ISceneLoaderPlugin, ISceneLoaderPluginAsync, Quaternion, Light, ShadowLight, ShadowGenerator, Tags, AutoRotationBehavior, BouncingBehavior, FramingBehavior, Behavior, Tools } from 'babylonjs';
 import { ViewerConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, IObserversConfiguration, IModelConfiguration, ISkyboxConfiguration, IGroundConfiguration, ILightConfiguration, ICameraConfiguration } from '../configuration/configuration';
 
 import * as deepmerge from '../../assets/deepmerge.min.js';
@@ -33,6 +33,8 @@ export abstract class AbstractViewer {
     protected maxShadows: number;
     private _hdrSupport: boolean;
 
+    protected _isDisposed: boolean = false;
+
     public get isHdrSupported() {
         return this._hdrSupport;
     }
@@ -50,6 +52,7 @@ export abstract class AbstractViewer {
     public canvas: HTMLCanvasElement;
 
     protected registeredOnBeforerenderFunctions: Array<() => void>;
+    protected _configurationLoader: ConfigurationLoader;
 
     constructor(public containerElement: HTMLElement, initialConfiguration: ViewerConfiguration = {}) {
         // if exists, use the container id. otherwise, generate a random string.
@@ -79,7 +82,8 @@ export abstract class AbstractViewer {
         this.prepareContainerElement();
 
         // extend the configuration
-        configurationLoader.loadConfiguration(initialConfiguration, (configuration) => {
+        this._configurationLoader = new ConfigurationLoader();
+        this._configurationLoader.loadConfiguration(initialConfiguration, (configuration) => {
             this.configuration = deepmerge(this.configuration || {}, configuration);
             if (this.configuration.observers) {
                 this.configureObservers(this.configuration.observers);
@@ -619,20 +623,55 @@ export abstract class AbstractViewer {
     }
 
     public dispose() {
+        if (this._isDisposed) {
+            return;
+        }
         window.removeEventListener('resize', this.resize);
         if (this.sceneOptimizer) {
             this.sceneOptimizer.stop();
             this.sceneOptimizer.dispose();
         }
 
+        if (this.environmentHelper) {
+            this.environmentHelper.dispose();
+        }
+
+        if (this._configurationLoader) {
+            this._configurationLoader.dispose();
+        }
+
+        //observers
+        this.onEngineInitObservable.clear();
+        delete this.onEngineInitObservable;
+        this.onInitDoneObservable.clear();
+        delete this.onInitDoneObservable;
+        this.onLoaderInitObservable.clear();
+        delete this.onLoaderInitObservable;
+        this.onModelLoadedObservable.clear();
+        delete this.onModelLoadedObservable;
+        this.onModelLoadErrorObservable.clear();
+        delete this.onModelLoadErrorObservable;
+        this.onModelLoadProgressObservable.clear();
+        delete this.onModelLoadProgressObservable;
+        this.onSceneInitObservable.clear();
+        delete this.onSceneInitObservable;
+
         if (this.scene.activeCamera) {
             this.scene.activeCamera.detachControl(this.canvas);
         }
 
+        this.models.forEach(model => {
+            model.dispose();
+        });
+
+        this.models.length = 0;
+
         this.scene.dispose();
         this.engine.dispose();
 
         this.templateManager.dispose();
+        viewerManager.removeViewer(this);
+        this._isDisposed = true;
     }
 
     protected abstract prepareContainerElement();
@@ -656,12 +695,12 @@ export abstract class AbstractViewer {
      */
     private _onTemplateLoaded(): Promise<AbstractViewer> {
         return this.onTemplatesLoaded().then(() => {
-            let autoLoadModel = !!this.configuration.model;
+            let autoLoadModel = this.configuration.model;
             return this.initEngine().then((engine) => {
                 return this.onEngineInitObservable.notifyObserversWithPromise(engine);
             }).then(() => {
                 if (autoLoadModel) {
-                    return this.loadModel().then(() => { return this.scene });
+                    return this.loadModel().catch(e => { }).then(() => { return this.scene });
                 } else {
                     return this.scene || this.initScene();
                 }
@@ -669,6 +708,9 @@ export abstract class AbstractViewer {
                 return this.onSceneInitObservable.notifyObserversWithPromise(scene);
             }).then(() => {
                 return this.onInitDoneObservable.notifyObserversWithPromise(this);
+            }).catch(e => {
+                Tools.Warn(e.toString());
+                return this;
             });
         })
     }

+ 14 - 2
Viewer/src/viewer/viewerManager.ts

@@ -1,5 +1,3 @@
-/// <reference path="../../../dist/preview release/babylon.d.ts"/>
-
 import { Observable } from 'babylonjs';
 import { AbstractViewer } from './viewer';
 
@@ -9,10 +7,12 @@ export class ViewerManager {
 
     public onViewerAdded: (viewer: AbstractViewer) => void;
     public onViewerAddedObservable: Observable<AbstractViewer>;
+    public onViewerRemovedObservable: Observable<string>;
 
     constructor() {
         this.viewers = {};
         this.onViewerAddedObservable = new Observable();
+        this.onViewerRemovedObservable = new Observable();
     }
 
     public addViewer(viewer: AbstractViewer) {
@@ -20,6 +20,12 @@ export class ViewerManager {
         this._onViewerAdded(viewer);
     }
 
+    public removeViewer(viewer: AbstractViewer) {
+        let id = viewer.getBaseId();
+        delete this.viewers[id];
+        this.onViewerRemovedObservable.notifyObservers(id);
+    }
+
     public getViewerById(id: string): AbstractViewer {
         return this.viewers[id];
     }
@@ -52,6 +58,12 @@ export class ViewerManager {
         this.onViewerAdded && this.onViewerAdded(viewer);
         this.onViewerAddedObservable.notifyObservers(viewer);
     }
+
+    public dispose() {
+        for (let id in this.viewers) {
+            this.viewers[id].dispose();
+        }
+    }
 }
 
 export let viewerManager = new ViewerManager();

+ 3 - 1
Viewer/webpack.config.js

@@ -24,7 +24,9 @@ module.exports = {
     },
     externals: {
         // until physics will be integrated in the viewer, ignore cannon
-        cannon: 'CANNON'
+        cannon: 'CANNON',
+        oimo: 'OIMO',
+        './Oimo': 'OIMO'
     },
     devtool: 'source-map',
     plugins: [

+ 2 - 1
Viewer/webpack.gulp.config.js

@@ -12,7 +12,8 @@ module.exports = {
     externals: {
         cannon: 'CANNON',
         oimo: 'OIMO',
-        vertx: true
+        vertx: true,
+        "./Oimo": "OIMO"
     },
     resolve: {
         extensions: ['.ts', '.js'],

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3345 - 3340
dist/preview release/babylon.d.ts


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 43 - 43
dist/preview release/babylon.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 141 - 70
dist/preview release/babylon.max.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 43 - 43
dist/preview release/babylon.worker.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 13782 - 13777
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 43 - 43
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 139 - 70
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 139 - 70
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 141 - 70
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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 4 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -357,6 +357,10 @@ declare module BABYLON.GUI {
         protected _children: Control[];
         protected _measureForChildren: Measure;
         protected _background: string;
+        protected _adaptWidthToChildren: boolean;
+        protected _adaptHeightToChildren: boolean;
+        adaptHeightToChildren: boolean;
+        adaptWidthToChildren: boolean;
         background: string;
         readonly children: Control[];
         constructor(name?: string | undefined);

+ 50 - 0
dist/preview release/gui/babylon.gui.js

@@ -1994,8 +1994,44 @@ var BABYLON;
                 _this.name = name;
                 _this._children = new Array();
                 _this._measureForChildren = GUI.Measure.Empty();
+                _this._adaptWidthToChildren = false;
+                _this._adaptHeightToChildren = false;
                 return _this;
             }
+            Object.defineProperty(Container.prototype, "adaptHeightToChildren", {
+                get: function () {
+                    return this._adaptHeightToChildren;
+                },
+                set: function (value) {
+                    if (this._adaptHeightToChildren === value) {
+                        return;
+                    }
+                    this._adaptHeightToChildren = value;
+                    if (value) {
+                        this.height = "100%";
+                    }
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(Container.prototype, "adaptWidthToChildren", {
+                get: function () {
+                    return this._adaptWidthToChildren;
+                },
+                set: function (value) {
+                    if (this._adaptWidthToChildren === value) {
+                        return;
+                    }
+                    this._adaptWidthToChildren = value;
+                    if (value) {
+                        this.width = "100%";
+                    }
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
             Object.defineProperty(Container.prototype, "background", {
                 get: function () {
                     return this._background;
@@ -2119,6 +2155,8 @@ var BABYLON;
                 if (this._processMeasures(parentMeasure, context)) {
                     this._localDraw(context);
                     this._clipForChildren(context);
+                    var computedWidth = -1;
+                    var computedHeight = -1;
                     for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                         var child = _a[_i];
                         if (child.isVisible && !child.notRenderable) {
@@ -2127,8 +2165,20 @@ var BABYLON;
                             if (child.onAfterDrawObservable.hasObservers()) {
                                 child.onAfterDrawObservable.notifyObservers(child);
                             }
+                            if (this.adaptWidthToChildren && child._width.isPixel) {
+                                computedWidth = Math.max(computedWidth, child._currentMeasure.width);
+                            }
+                            if (this.adaptHeightToChildren && child._height.isPixel) {
+                                computedHeight = Math.max(computedHeight, child._currentMeasure.height);
+                            }
                         }
                     }
+                    if (this.adaptWidthToChildren && computedWidth >= 0) {
+                        this.width = computedWidth + "px";
+                    }
+                    if (this.adaptHeightToChildren && computedHeight >= 0) {
+                        this.height = computedHeight + "px";
+                    }
                 }
                 context.restore();
                 if (this.onAfterDrawObservable.hasObservers()) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


+ 4 - 0
dist/preview release/gui/babylon.gui.module.d.ts

@@ -363,6 +363,10 @@ declare module BABYLON.GUI {
         protected _children: Control[];
         protected _measureForChildren: Measure;
         protected _background: string;
+        protected _adaptWidthToChildren: boolean;
+        protected _adaptHeightToChildren: boolean;
+        adaptHeightToChildren: boolean;
+        adaptWidthToChildren: boolean;
         background: string;
         readonly children: Control[];
         constructor(name?: string | undefined);

+ 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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 4 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1792,7 +1792,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;
@@ -2020,7 +2022,7 @@ var BABYLON;
                                 if (indexLOD !== 0) {
                                     var previousNodeLOD = nodeLODs[indexLOD - 1];
                                     if (previousNodeLOD._babylonMesh) {
-                                        previousNodeLOD._babylonMesh.dispose();
+                                        previousNodeLOD._babylonMesh.dispose(false, true);
                                         delete previousNodeLOD._babylonMesh;
                                     }
                                 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 4 - 2
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -3990,7 +3990,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;
@@ -4218,7 +4220,7 @@ var BABYLON;
                                 if (indexLOD !== 0) {
                                     var previousNodeLOD = nodeLODs[indexLOD - 1];
                                     if (previousNodeLOD._babylonMesh) {
-                                        previousNodeLOD._babylonMesh.dispose();
+                                        previousNodeLOD._babylonMesh.dispose(false, true);
                                         delete previousNodeLOD._babylonMesh;
                                     }
                                 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 4 - 2
dist/preview release/loaders/babylonjs.loaders.js

@@ -4973,7 +4973,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;
@@ -5192,7 +5194,7 @@ var BABYLON;
                                 if (indexLOD !== 0) {
                                     var previousNodeLOD = nodeLODs[indexLOD - 1];
                                     if (previousNodeLOD._babylonMesh) {
-                                        previousNodeLOD._babylonMesh.dispose();
+                                        previousNodeLOD._babylonMesh.dispose(false, true);
                                         delete previousNodeLOD._babylonMesh;
                                     }
                                 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
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-alphaC",
+    "version": "3.2.0-beta.1",
     "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-alphaC"
+        "babylonjs-gltf2interface": "3.2.0-beta.1"
     },
     "peerDependencies": {
         "babylonjs": ">=3.2.0-alpha"

+ 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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 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-alphaC",
+    "version": "3.2.0-beta.1",
     "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-alphaC"
+        "babylonjs-gltf2interface": "3.2.0-beta.1"
     },
     "peerDependencies": {
         "babylonjs": ">=3.2.0-alpha"

+ 5 - 0
dist/preview release/viewer/babylon.viewer.d.ts

@@ -2,6 +2,8 @@ declare module BabylonViewer {
 
     export let disableInit: boolean;
 
+    export function disposeAll(): void;
+
     export interface ITemplateConfiguration {
         location?: string;
         html?: string;
@@ -91,7 +93,9 @@ declare module BabylonViewer {
     interface ViewerManager {
         onViewerAdded: (viewer: AbstractViewer) => void;
         onViewerAddedObservable: BABYLON.Observable<AbstractViewer>;
+        onViewerRemovedObservable: BABYLON.Observable<string>;
         addViewer(viewer: AbstractViewer): void;
+        removeViewer(viewer: AbstractViewer): void;
         getViewerById(id: string): AbstractViewer;
         getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
         getViewerPromiseById(id: string): Promise<AbstractViewer>;
@@ -462,6 +466,7 @@ declare module BabylonViewer {
         protected defaultPipelineTextureType: number;
         protected maxShadows: number;
         readonly isHdrSupported: boolean;
+        protected _isDisposed: boolean;
         onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
         onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
         onModelLoadedObservable: BABYLON.Observable<ViewerModel>;

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 64 - 69
dist/preview release/viewer/babylon.viewer.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 549 - 12927
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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

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

@@ -14,7 +14,7 @@
 - Added [GlowLayer](https://doc.babylonjs.com/how_to/glow_layer) to easily support glow from emissive materials. Demo [here](http://www.babylonjs.com/demos/GlowLayer/) ([sebavan](https://github.com/sebavan))
 - New [AssetContainer](http://doc.babylonjs.com/how_to/how_to_use_assetcontainer) class and loading methods ([trevordev](https://github.com/trevordev))
 - Added [depth of field](https://www.babylonjs-playground.com/frame.html#8F5HYV#5), sharpening, MSAA, chromatic aberration and grain effect to the default pipeline ([trevordev](https://github.com/trevordev))
-- Added support for [animation weights](http://doc.babylonjs.com/babylon101/animations#animation-weights). Demo [here](https://www.babylonjs-playground.com/#IQN716#3) ([deltakosh](https://github.com/deltakosh))
+- Added support for [animation weights](http://doc.babylonjs.com/babylon101/animations#animation-weights). Demo [here](https://www.babylonjs-playground.com/#IQN716#8) ([deltakosh](https://github.com/deltakosh))
 - Added [sub emitters for particle system](http://doc.babylonjs.com/babylon101/particles#sub-emitters) which will spawn new particle systems when particles dies. Demo [here](https://www.babylonjs-playground.com/frame.html#9NHBCC#1) ([IbraheemOsama](https://github.com/IbraheemOsama))
 - New [Babylon.js](http://doc.babylonjs.com/resources/maya) and [glTF](http://doc.babylonjs.com/resources/maya_to_gltf) exporter for Autodesk Maya ([Noalak](https://github.com/Noalak))
 - New glTF [serializer](https://github.com/BabylonJS/Babylon.js/tree/master/serializers/src/glTF/2.0). You can now export glTF or glb files directly from a Babylon scene ([kcoley](https://github.com/kcoley))

+ 56 - 0
gui/src/controls/container.ts

@@ -5,6 +5,44 @@ module BABYLON.GUI {
         protected _children = new Array<Control>();
         protected _measureForChildren = Measure.Empty();  
         protected _background: string;   
+        protected _adaptWidthToChildren = false;
+        protected _adaptHeightToChildren = false;
+
+        public get adaptHeightToChildren(): boolean {
+            return this._adaptHeightToChildren;
+        }
+
+        public set adaptHeightToChildren(value: boolean) {
+            if (this._adaptHeightToChildren === value) {
+                return;
+            }
+
+            this._adaptHeightToChildren = value;
+
+            if (value) {
+                this.height = "100%";
+            }
+
+            this._markAsDirty();
+        }       
+        
+        public get adaptWidthToChildren(): boolean {
+            return this._adaptWidthToChildren;
+        }
+
+        public set adaptWidthToChildren(value: boolean) {
+            if (this._adaptWidthToChildren === value) {
+                return;
+            }
+
+            this._adaptWidthToChildren = value;
+
+            if (value) {
+                this.width = "100%";
+            }
+
+            this._markAsDirty();
+        }           
 
         public get background(): string {
             return this._background;
@@ -159,6 +197,10 @@ module BABYLON.GUI {
                 this._localDraw(context);
 
                 this._clipForChildren(context);
+
+                let computedWidth = -1;
+                let computedHeight = -1;
+
                 for (var child of this._children) {
                     if (child.isVisible && !child.notRenderable) {
                         child._tempParentMeasure.copyFrom(this._measureForChildren);
@@ -167,8 +209,22 @@ module BABYLON.GUI {
                         if (child.onAfterDrawObservable.hasObservers()) {
                             child.onAfterDrawObservable.notifyObservers(child);
                         }
+
+                        if (this.adaptWidthToChildren && child._width.isPixel) {
+                            computedWidth = Math.max(computedWidth, child._currentMeasure.width);
+                        }
+                        if (this.adaptHeightToChildren && child._height.isPixel) {
+                            computedHeight = Math.max(computedHeight, child._currentMeasure.height);
+                        }                        
                     }
                 }
+
+                if (this.adaptWidthToChildren && computedWidth >= 0) {
+                    this.width = computedWidth + "px";
+                }
+                if (this.adaptHeightToChildren && computedHeight >= 0) {
+                    this.height = computedHeight + "px";
+                }                
             }
             context.restore();
 

+ 1 - 2
gui/src/tsconfig.json

@@ -7,7 +7,6 @@
     "noImplicitReturns": true,
     "noImplicitThis": true,
     "noUnusedLocals": true,    
-    "strictNullChecks": true,
-    "strict": true
+    "strictNullChecks": true    
   }
 }

+ 1 - 1
loaders/src/glTF/2.0/Extensions/MSFT_lod.ts

@@ -43,7 +43,7 @@ module BABYLON.GLTF2.Extensions {
                         if (indexLOD !== 0) {
                             const previousNodeLOD = nodeLODs[indexLOD - 1];
                             if (previousNodeLOD._babylonMesh) {
-                                previousNodeLOD._babylonMesh.dispose();
+                                previousNodeLOD._babylonMesh.dispose(false, true);
                                 delete previousNodeLOD._babylonMesh;
                             }
                         }

+ 3 - 1
loaders/src/glTF/2.0/babylon.glTFLoader.ts

@@ -1512,7 +1512,9 @@ module BABYLON.GLTF2 {
         }
 
         private static _GetDrawMode(context: string, mode: number | undefined): number {
-            mode = mode || MeshPrimitiveMode.TRIANGLES;
+            if (mode == undefined) {
+                mode = MeshPrimitiveMode.TRIANGLES;
+            }
 
             switch (mode) {
                 case MeshPrimitiveMode.POINTS: return Material.PointListDrawMode;

+ 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-alphaC",
+    "version": "3.2.0-beta.1",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 4 - 0
src/Animations/babylon.animatable.ts

@@ -220,6 +220,10 @@
                 this._pausedDelay = null;
             }
 
+            if (this._weight === 0) { // We consider that an animation with a weight === 0 is "actively" paused
+                return true;
+            }
+
             // Animating
             var running = false;
             var runtimeAnimations = this._runtimeAnimations;

+ 32 - 20
src/Animations/babylon.runtimeAnimation.ts

@@ -1,11 +1,12 @@
 module BABYLON {
 
     export class RuntimeAnimation {
-        public currentFrame: number;
+        public currentFrame: number = 0;
         private _animation: Animation;
         private _target: any;
 
         private _originalValue: any;
+        private _originalBlendValue: any;
         private _offsetsCache: {[key: string]: any} = {};
         private _highLimitsCache: {[key: string]: any} = {};
         private _stopped = false;
@@ -14,7 +15,7 @@
 
         private _currentValue: any;
         private _activeTarget: any;
-        private _targetPath: string;
+        private _targetPath: string = "";
         private _weight = 1.0
 
         /**
@@ -242,7 +243,7 @@
                     property = property[targetPropertyPath[index]];
                 }
 
-                path =  [targetPropertyPath.length - 1];
+                path =  targetPropertyPath[targetPropertyPath.length - 1];
                 destination = property;
             } else {
                 path = targetPropertyPath[0];
@@ -257,14 +258,26 @@
             let enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             let blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
             
-            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    let originalValue = destination[path];
+
+                    if (originalValue.clone) {
+                        this._originalBlendValue = originalValue.clone();
+                    } else {
+                        this._originalBlendValue = originalValue;
+                    }
+                }
+            }
+
+            if (weight !== -1.0) {
                 if (!this._originalValue) {
                     let originalValue: any;
 
                     if (destination.getRestPose) { // For bones
                         originalValue = destination.getRestPose();
                     } else {
-                        originalValue = destination[path]
+                        originalValue = destination[path];
                     }
 
                     if (originalValue.clone) {
@@ -276,29 +289,28 @@
             }
 
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalValue.prototype) { // Complex value
+                if (this._originalBlendValue.prototype) { // Complex value
                     
-                    if (this._originalValue.prototype.Lerp) { // Lerp supported
-                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
+                    if (this._originalBlendValue.prototype.Lerp) { // Lerp supported
+                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
                     } else { // Blending not supported
                         this._currentValue = currentValue;
                     }
 
-                } else if (this._originalValue.m) { // Matrix
-                    this._currentValue = Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
+                } else if (this._originalBlendValue.m) { // Matrix
+                    this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                 } else { // Direct value
-                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
-                
-                destination[path] = this._currentValue;
             } else {
                 this._currentValue = currentValue;
-                if (weight !== -1.0) {
-                    this._scene._registerTargetForLateAnimationBinding(this);
-                } else {
-                    destination[path] = this._currentValue;
-                }
+            }
+
+            if (weight !== -1.0) {
+                this._scene._registerTargetForLateAnimationBinding(this);
+            } else {
+                destination[path] = this._currentValue;
             }
 
             if (this._target.markAsDirty) {
@@ -339,8 +351,8 @@
         }
 
         private _ratioOffset = 0;
-        private _previousDelay: number;
-        private _previousRatio: number;
+        private _previousDelay: number = 0;
+        private _previousRatio: number = 0;
 
         /**
          * Execute the current animation

+ 18 - 2
src/Layer/babylon.effectLayer.ts

@@ -372,6 +372,18 @@
                 defines.push("#define NUM_BONE_INFLUENCERS 0");
             }
 
+            // Morph targets         
+            var manager = (<Mesh>mesh).morphTargetManager;
+            let morphInfluencers = 0;
+            if (manager) {
+                if (manager.numInfluencers > 0) {
+                    defines.push("#define MORPHTARGETS");
+                    morphInfluencers = manager.numInfluencers;
+                    defines.push("#define NUM_MORPH_INFLUENCERS " + morphInfluencers);
+                    MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, {"NUM_MORPH_INFLUENCERS": morphInfluencers });
+                }
+            }            
+
             // Instances
             if (useInstances) {
                 defines.push("#define INSTANCES");
@@ -387,8 +399,9 @@
                 this._cachedDefines = join;
                 this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration",
                     attribs,
-                    ["world", "mBones", "viewProjection", "diffuseMatrix", "color", "emissiveMatrix"],
-                    ["diffuseSampler", "emissiveSampler"], join);
+                    ["world", "mBones", "viewProjection", "diffuseMatrix", "color", "emissiveMatrix", "morphTargetInfluences"],
+                    ["diffuseSampler", "emissiveSampler"], join,
+                    undefined, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });
             }
 
             return this._effectLayerMapGenerationEffect.isReady();
@@ -558,6 +571,9 @@
                     this._effectLayerMapGenerationEffect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
                 }
 
+                // Morph targets
+                MaterialHelper.BindMorphTargetParameters(mesh, this._effectLayerMapGenerationEffect);
+
                 // Draw
                 mesh._processRendering(subMesh, this._effectLayerMapGenerationEffect, Material.TriangleFillMode, batch, hardwareInstancedRendering,
                     (isInstance, world) => this._effectLayerMapGenerationEffect.setMatrix("world", world));

+ 18 - 2
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -902,6 +902,9 @@
                     this._effect.setMatrices("mBones", (<Skeleton>mesh.skeleton).getTransformMatrices((mesh)));
                 }
 
+                // Morph targets
+                MaterialHelper.BindMorphTargetParameters(mesh, this._effect);
+
                 if (this.forceBackFacesOnly) {
                     engine.setState(true, 0, false, true);
                 }
@@ -1075,6 +1078,18 @@
                 defines.push("#define NUM_BONE_INFLUENCERS 0");
             }
 
+            // Morph targets         
+            var manager = (<Mesh>mesh).morphTargetManager;
+            let morphInfluencers = 0;
+            if (manager) {
+                if (manager.numInfluencers > 0) {
+                    defines.push("#define MORPHTARGETS");
+                    morphInfluencers = manager.numInfluencers;
+                    defines.push("#define NUM_MORPH_INFLUENCERS " + morphInfluencers);
+                    MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, {"NUM_MORPH_INFLUENCERS": morphInfluencers });
+                }
+            }
+
             // Instances
             if (useInstances) {
                 defines.push("#define INSTANCES");
@@ -1090,8 +1105,9 @@
                 this._cachedDefines = join;
                 this._effect = this._scene.getEngine().createEffect("shadowMap",
                     attribs,
-                    ["world", "mBones", "viewProjection", "diffuseMatrix", "lightData", "depthValues", "biasAndScale"],
-                    ["diffuseSampler"], join);
+                    ["world", "mBones", "viewProjection", "diffuseMatrix", "lightData", "depthValues", "biasAndScale", "morphTargetInfluences"],
+                    ["diffuseSampler"], join,
+                    undefined, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });
             }
 
             if (!this._effect.isReady()) {

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

@@ -1344,7 +1344,7 @@
             }
 
             // Skeleton
-            this.skeleton = null;
+            this._skeleton = null;
 
             // Physics
             if (this.physicsImpostor) {

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

@@ -186,7 +186,9 @@
                 }
 
                 // Deep copy
-                Tools.DeepCopy(source, this, ["name", "material", "skeleton", "instances", "parent", "uniqueId", "source", "metadata"], ["_poseMatrix", "_source"]);
+                Tools.DeepCopy(source, this, ["name", "material", "skeleton", "instances", "parent", "uniqueId", 
+                                              "source", "metadata", "hasLODLevels", "geometry", "isBlocked", "areNormalsFrozen"], 
+                                              ["_poseMatrix", "_source"]);
 
                 // Metadata
                 if (source.metadata && source.metadata.clone) {

+ 1 - 1
src/Particles/EmitterTypes/babylon.coneParticleEmitter.ts

@@ -84,7 +84,7 @@ module BABYLON {
             // Better distribution in a cone at normal angles.
             h = 1 - h * h;
             var radius = Scalar.RandomRange(0, this._radius);
-            radius = radius * h / this._height;
+            radius = radius * h;
 
             var randX = radius * Math.sin(s);
             var randZ = radius * Math.cos(s);

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

@@ -262,8 +262,14 @@
          * @return true if the system is ready
          */
         public isReady(): boolean {
-            if (!this.emitter || !this._updateEffect || !this._renderEffect || 
-                !this._updateEffect.isReady() || !this._renderEffect.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {
+            if (!this._updateEffect) {
+                this._recreateUpdateEffect();
+                this._recreateRenderEffect();
+                return false;
+            }
+
+
+            if (!this.emitter || !this._updateEffect.isReady() || !this._renderEffect.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {
                 return false;
             }
 

+ 1 - 1
src/Particles/babylon.particleSystem.ts

@@ -997,11 +997,11 @@
          */
         public createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter {
             var particleEmitter = new BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         }
 

+ 0 - 3
src/PostProcess/babylon.vrDistortionCorrectionPostProcess.ts

@@ -1,7 +1,5 @@
 module BABYLON {
     export class VRDistortionCorrectionPostProcess extends PostProcess {
-        public aspectRatio: number;
-
         private _isRightEye: boolean;
         private _distortionFactors: number[];
         private _postProcessScaleFactor: number;
@@ -25,7 +23,6 @@
             this.adaptScaleToCurrentViewport = true;
 
             this.onSizeChangedObservable.add(() => {
-                this.aspectRatio = this.width * .5 / this.height;
                 this._scaleIn = new Vector2(2, 2 / this.aspectRatio);
                 this._scaleFactor = new Vector2(.5 * (1 / this._postProcessScaleFactor), .5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);
                 this._lensCenter = new Vector2(this._isRightEye ? 0.5 - this._lensCenterOffset * 0.5 : 0.5 + this._lensCenterOffset * 0.5, 0.5);

+ 8 - 2
src/Shaders/glowMapGeneration.vertex.fx

@@ -3,6 +3,9 @@ attribute vec3 position;
 
 #include<bonesDeclaration>
 
+#include<morphTargetsVertexGlobalDeclaration>
+#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
+
 // Uniforms
 #include<instancesDeclaration>
 
@@ -30,14 +33,17 @@ attribute vec2 uv2;
 
 void main(void)
 {
+	vec3 positionUpdated = position;
+
+#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
 #include<instancesVertex>
 #include<bonesVertex>
 
 #ifdef CUBEMAP
-	vPosition = finalWorld * vec4(position, 1.0);
+	vPosition = finalWorld * vec4(positionUpdated, 1.0);
 	gl_Position = viewProjection * finalWorld * vec4(position, 1.0);
 #else
-	vPosition = viewProjection * finalWorld * vec4(position, 1.0);
+	vPosition = viewProjection * finalWorld * vec4(positionUpdated, 1.0);
 	gl_Position = vPosition;
 #endif
 

+ 1 - 1
src/Shaders/gpuUpdateParticles.vertex.fx

@@ -133,7 +133,7 @@ void main() {
     // Better distribution in a cone at normal angles.
     h = 1. - h * h;
     float lRadius = radius * randoms2.z;
-    lRadius = lRadius * h / height;
+    lRadius = lRadius * h;
 
     float randX = lRadius * sin(s);
     float randZ = lRadius * cos(s);

+ 8 - 1
src/Shaders/shadowMap.vertex.fx

@@ -8,6 +8,9 @@ attribute vec3 position;
 
 #include<bonesDeclaration>
 
+#include<morphTargetsVertexGlobalDeclaration>
+#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
+
 // Uniforms
 #include<instancesDeclaration>
 #include<helperFunctions>
@@ -31,10 +34,14 @@ attribute vec2 uv2;
 
 void main(void)
 {
+vec3 positionUpdated = position;
+
+#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
+
 #include<instancesVertex>
 #include<bonesVertex>
 
-vec4 worldPos = finalWorld * vec4(position, 1.0);
+vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);
 
 // Normal inset Bias.
 #ifdef NORMAL

+ 4 - 6
src/Tools/babylon.promise.ts

@@ -91,10 +91,9 @@ module BABYLON {
             }
         }
 
-        private _resolve(value?: Nullable<T>): Nullable<InternalPromise<T>> | T {
+        private _resolve(value?: Nullable<T>): void {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 let returnedValue: Nullable<InternalPromise<T>> | T = null;
 
                 if (this._onFulfilled) {
@@ -107,11 +106,14 @@ module BABYLON {
                         let returnedPromise = returnedValue as InternalPromise<T>;
 
                         returnedPromise._moveChildren(this._children);
+                        value = returnedPromise._result;
                     } else {
                         value = <T>returnedValue;
                     }
                 }
 
+                this._result = value;
+
                 for (var child of this._children) {
                     child._resolve(value);
                 }
@@ -119,13 +121,9 @@ module BABYLON {
                 this._children.length = 0;
                 delete this._onFulfilled;
                 delete this._onRejected;
-
-                return returnedValue;
             } catch (e) {
                 this._reject(e, true);
             }
-
-            return null;
         }
 
         private _reject(reason: any, onLocalThrow = false): void {

+ 25 - 11
src/babylon.scene.ts

@@ -222,7 +222,7 @@
         */
         public onDisposeObservable = new Observable<Scene>();
 
-        private _onDisposeObserver: Nullable<Observer<Scene>>;
+        private _onDisposeObserver: Nullable<Observer<Scene>> = null;
         /** A function to be executed when this scene is disposed. */
         public set onDispose(callback: () => void) {
             if (this._onDisposeObserver) {
@@ -237,7 +237,7 @@
         */
         public onBeforeRenderObservable = new Observable<Scene>();
 
-        private _onBeforeRenderObserver: Nullable<Observer<Scene>>;
+        private _onBeforeRenderObserver: Nullable<Observer<Scene>> = null;
         /** A function to be executed before rendering this scene */
         public set beforeRender(callback: Nullable<() => void>) {
             if (this._onBeforeRenderObserver) {
@@ -254,7 +254,7 @@
         */
         public onAfterRenderObservable = new Observable<Scene>();
 
-        private _onAfterRenderObserver: Nullable<Observer<Scene>>;
+        private _onAfterRenderObserver: Nullable<Observer<Scene>> = null;
         /** A function to be executed after rendering this scene */
         public set afterRender(callback: Nullable<() => void>) {
             if (this._onAfterRenderObserver) {
@@ -314,7 +314,7 @@
         */
         public onBeforeCameraRenderObservable = new Observable<Camera>();
 
-        private _onBeforeCameraRenderObserver: Nullable<Observer<Camera>>;
+        private _onBeforeCameraRenderObserver: Nullable<Observer<Camera>> = null;
         public set beforeCameraRender(callback: () => void) {
             if (this._onBeforeCameraRenderObserver) {
                 this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
@@ -329,7 +329,7 @@
         */
         public onAfterCameraRenderObservable = new Observable<Camera>();
 
-        private _onAfterCameraRenderObserver: Nullable<Observer<Camera>>;
+        private _onAfterCameraRenderObserver: Nullable<Observer<Camera>> = null;
         public set afterCameraRender(callback: () => void) {
             if (this._onAfterCameraRenderObserver) {
                 this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);
@@ -2139,9 +2139,7 @@
                 }
             }
 
-            if (stopCurrent) {
-                animatable.reset();
-            }
+            animatable.reset();
 
             return animatable;
         }
@@ -2199,6 +2197,22 @@
             return null;
         }
 
+        /**
+         * Gets all animatables associated with a given target
+         * @param target defines the target to look animatables for
+         * @returns an array of Animatables
+         */
+        public getAllAnimatablesByTarget(target: any): Array<Animatable> {
+            let result = [];
+            for (var index = 0; index < this._activeAnimatables.length; index++) {
+                if (this._activeAnimatables[index].target === target) {
+                    result.push(this._activeAnimatables[index]);
+                }
+            }
+
+            return result;
+        }        
+
         public get animatables(): Animatable[] {
             return this._activeAnimatables;
         }
@@ -2206,13 +2220,13 @@
         /**
          * 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)
+         * @param animationName - the name of the animation to stop (all animations will be stopped if empty)
          * @see beginAnimation
          */
         public stopAnimation(target: any, animationName?: string): void {
-            var animatable = this.getAnimatableByTarget(target);
+            var animatables = this.getAllAnimatablesByTarget(target);
 
-            if (animatable) {
+            for (var animatable of animatables) {
                 animatable.stop(animationName);
             }
         }

+ 0 - 1
src/tsconfig.json

@@ -8,7 +8,6 @@
     "isolatedModules": false,
     "sourceMap": true,
     "types": [],
-    "strict": true,
     "noImplicitAny": true,
     "noImplicitReturns": true,
     "noImplicitThis": true,

+ 58 - 0
tests/unit/babylon/src/Tools/babylon.promise.tests.ts

@@ -122,6 +122,64 @@ describe('Babylon.Promise', function () {
 
             tempString += " second";
         });
+
+        it('should chain promises correctly #5', (done) => {
+            var tempString = "";
+            var promise = new Promise(function (resolve) {
+                setTimeout(function () {
+                    resolve(44);
+                }, 100);
+            });
+        
+            promise = promise.then(function () {
+                return 55;
+            });
+        
+            promise.then(function (value) {
+                tempString += "1: " + value;
+                setTimeout(function () {
+                    promise.then(function (value) {
+                        tempString += " 2: " + value;
+                        try {
+                            expect(tempString).to.eq("1: 55 2: 55");
+                            done();
+                        }
+                        catch(error) {
+                            done(error);
+                        }                        
+                    });
+                }, 0);
+            });
+        });
+
+        it('should chain promises correctly #6', (done) => {
+            var tempString = "";
+            var promise = new Promise(function (resolve) {
+                setTimeout(function () {
+                    resolve(44);
+                }, 100);
+            });
+        
+            promise = promise.then(function () {
+                return Promise.resolve(55);
+            });
+        
+            promise.then(function (value) {
+                tempString += "1: " + value;
+                setTimeout(function () {
+                    promise.then(function (value) {
+                        tempString += " 2: " + value;
+                        try {
+                            expect(tempString).to.eq("1: 55 2: 55");
+                            done();
+                        }
+                        catch(error) {
+                            done(error);
+                        }                        
+                    });
+                }, 0);
+            });
+        });
     });
 
     describe('#Promise.all', () => {