David Catuhe 7 лет назад
Родитель
Сommit
640509fc94
33 измененных файлов с 20277 добавлено и 20189 удалено
  1. 10911 10891
      Playground/babylon.d.txt
  2. 6 6
      Tools/Gulp/package.json
  3. 2 2
      Tools/Publisher/package.json
  4. 1 1
      Viewer/package.json
  5. 1 1
      Viewer/src/initializer.ts
  6. 5 2
      Viewer/src/templating/templateManager.ts
  7. 12 9
      Viewer/src/viewer/defaultViewer.ts
  8. 2 2
      Viewer/src/viewer/viewer.ts
  9. 4 3
      Viewer/tests/unit/src/viewer/viewer.ts
  10. 44 44
      Viewer/tests/validation/index.html
  11. 9081 9061
      dist/preview release/babylon.d.ts
  12. 1 1
      dist/preview release/babylon.js
  13. 19 4
      dist/preview release/babylon.max.js
  14. 19 4
      dist/preview release/babylon.no-module.max.js
  15. 1 1
      dist/preview release/babylon.worker.js
  16. 19 4
      dist/preview release/es6.js
  17. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js
  18. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js.map
  19. 12 26
      dist/preview release/viewer/babylon.viewer.d.ts
  20. 2 2
      dist/preview release/viewer/babylon.viewer.js
  21. 3 3
      dist/preview release/viewer/babylon.viewer.max.js
  22. 12 29
      dist/preview release/viewer/babylon.viewer.module.d.ts
  23. 1 1
      gui/package.json
  24. 1 1
      inspector/package.json
  25. 4 1
      inspector/src/Inspector.ts
  26. 1 1
      inspector/src/scheduler/Scheduler.ts
  27. 2 2
      package.json
  28. 1 1
      src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts
  29. 63 60
      src/Engine/babylon.engine.ts
  30. 12 0
      src/Mesh/babylon.linesMesh.ts
  31. 1 1
      src/Tools/babylon.assetsManager.ts
  32. 21 21
      src/Tools/babylon.tools.ts
  33. 11 2
      src/babylon.mixins.ts

Разница между файлами не показана из-за своего большого размера
+ 10911 - 10891
Playground/babylon.d.txt


+ 6 - 6
Tools/Gulp/package.json

@@ -1,6 +1,6 @@
 {
-    "name": "BabylonJS",
-    "version": "3.1.1",
+    "name": "babylonjs",
+    "version": "3.3.0",
     "description": "Babylon.js is a 3D engine based on webgl and javascript",
     "main": "",
     "repository": {
@@ -23,6 +23,7 @@
         "gulp-rename": "^1.4.0",
         "gulp-replace": "~1.0.0",
         "gulp-sourcemaps": "~2.6.4",
+        "gulp-tslint": "^8.1.3",
         "gulp-typedoc": "^2.2.0",
         "gulp-typescript": "4.0.2",
         "gulp-uglify": "^3.0.1",
@@ -42,12 +43,11 @@
         "sinon": "^6.1.4",
         "through2": "~2.0.3",
         "ts-loader": "^4.4.2",
+        "tslint": "^5.11.0",
         "typedoc": "^0.12.0",
-        "typescript": "^3.0.1",
+        "typescript": "~3.0.1",
         "webpack": "^4.16.3",
-        "webpack-stream": "5.0.0",
-        "tslint": "^5.11.0",
-        "gulp-tslint": "^8.1.3"
+        "webpack-stream": "5.0.0"
     },
     "scripts": {
         "install": "cd ../../gui && npm install && cd ../Tools/Gulp/ &&  cd ../../inspector && npm install && cd ../Tools/Gulp/ && npm --prefix ../../Playground/ install ../../Playground/ && npm --prefix ../../tests/unit/ install ../../tests/unit/ && npm --prefix ../../Viewer/tests/ install ../../Viewer/tests/ && cd ../../Viewer && npm install && cd ../Tools/Gulp/ && gulp deployLocalDev"

+ 2 - 2
Tools/Publisher/package.json

@@ -12,9 +12,9 @@
         "fs-extra": "^5.0.0",
         "prompt": "^1.0.0",
         "shelljs": "^0.7.8",
-        "typescript": "^3.0.1"
+        "typescript": "~3.0.1",
     },
     "devDependencies": {
         "gulp": "^4.0.0"
     }
-}
+}

+ 1 - 1
Viewer/package.json

@@ -33,7 +33,7 @@
         "html-loader": "^0.5.5",
         "json-loader": "^0.5.7",
         "ts-loader": "^4.4.0",
-        "typescript": "^3.0.1",
+        "typescript": "~3.0.1",
         "uglifyjs-webpack-plugin": "^1.2.2",
         "webpack": "^4.16.0",
         "webpack-cli": "^3.0.8",

+ 1 - 1
Viewer/src/initializer.ts

@@ -24,7 +24,7 @@ export function initListeners() {
 export function InitTags(selector: string = 'babylon') {
     let elements = document.querySelectorAll(selector);
     for (let i = 0; i < elements.length; ++i) {
-        let element: HTMLElement = <HTMLElement>elements.item(i);
+        let element = elements.item(i);
 
         // get the html configuration
         let configMapper = mapperManager.getMapper('dom');

+ 5 - 2
Viewer/src/templating/templateManager.ts

@@ -51,7 +51,7 @@ export class TemplateManager {
 
     private templates: { [name: string]: Template };
 
-    constructor(public containerElement: HTMLElement) {
+    constructor(public containerElement: Element) {
         this.templates = {};
 
         this.onTemplateInit = new Observable<Template>();
@@ -410,7 +410,10 @@ export class Template {
             children = this._fragment.querySelectorAll('*');
         }
         for (let i = 0; i < children.length; ++i) {
-            childrenArray.push(kebabToCamel(children.item(i).nodeName.toLowerCase()));
+            const child = children.item(i);
+            if (child) {
+                childrenArray.push(kebabToCamel(child.nodeName.toLowerCase()));
+            }
         }
         return childrenArray;
     }

+ 12 - 9
Viewer/src/viewer/defaultViewer.ts

@@ -16,14 +16,14 @@ import { PrintButtonPlugin } from '../templating/plugins/printButton';
  */
 export class DefaultViewer extends AbstractViewer {
 
-    public fullscreenElement?: HTMLElement;
+    public fullscreenElement?: Element;
 
     /**
      * Create a new default viewer
      * @param containerElement the element in which the templates will be rendered
      * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
      */
-    constructor(public containerElement: HTMLElement, initialConfiguration: ViewerConfiguration = { extends: 'default' }) {
+    constructor(public containerElement: Element, initialConfiguration: ViewerConfiguration = { extends: 'default' }) {
         super(containerElement, initialConfiguration);
 
         this.onModelLoadedObservable.add(this._onModelLoaded);
@@ -102,7 +102,7 @@ export class DefaultViewer extends AbstractViewer {
                     }, () => {
                     }, () => {
                     }, () => {
-                    }, function () {
+                    }, function() {
                     }, (file: File) => {
                         this.loadModel(file);
                     }, () => {
@@ -364,15 +364,15 @@ export class DefaultViewer extends AbstractViewer {
         let fullscreenElement = this.fullscreenElement || viewerElement;
 
         if (fullscreenElement) {
-            let currentElement = document.fullscreenElement || document.webkitFullscreenElement || (<any>document).mozFullScreenElement || (<any>document).msFullscreenElement;
+            let currentElement = (<any>document).fullscreenElement || (<any>document).webkitFullscreenElement || (<any>document).mozFullScreenElement || (<any>document).msFullscreenElement;
             if (!currentElement) {
-                let requestFullScreen = fullscreenElement.requestFullscreen || fullscreenElement.webkitRequestFullscreen || (<any>fullscreenElement).msRequestFullscreen || (<any>fullscreenElement).mozRequestFullScreen;
+                let requestFullScreen = fullscreenElement.requestFullscreen || (<any>fullscreenElement).webkitRequestFullscreen || (<any>fullscreenElement).msRequestFullscreen || (<any>fullscreenElement).mozRequestFullScreen;
                 requestFullScreen.call(fullscreenElement);
                 if (viewerElement) {
                     viewerElement.classList.add("in-fullscreen");
                 }
             } else {
-                let exitFullscreen = document.exitFullscreen || document.webkitExitFullscreen || (<any>document).msExitFullscreen || (<any>document).mozCancelFullScreen
+                let exitFullscreen = document.exitFullscreen || (<any>document).webkitExitFullscreen || (<any>document).msExitFullscreen || (<any>document).mozCancelFullScreen
                 exitFullscreen.call(document);
                 if (viewerElement) {
                     viewerElement.classList.remove("in-fullscreen");
@@ -385,9 +385,12 @@ export class DefaultViewer extends AbstractViewer {
      * Preparing the container element to present the viewer
      */
     protected _prepareContainerElement() {
-        this.containerElement.style.position = 'relative';
-        this.containerElement.style.height = '100%';
-        this.containerElement.style.display = 'flex';
+        const htmlElement = this.containerElement as HTMLElement;
+        if (htmlElement.style) {
+            htmlElement.style.position = 'relative';
+            htmlElement.style.height = '100%';
+            htmlElement.style.display = 'flex';
+        }
     }
 
     /**

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

@@ -175,7 +175,7 @@ export abstract class AbstractViewer {
         return this._configurationContainer;
     }
 
-    constructor(public containerElement: HTMLElement, initialConfiguration: ViewerConfiguration = {}) {
+    constructor(public containerElement: Element, initialConfiguration: ViewerConfiguration = {}) {
         // if exists, use the container id. otherwise, generate a random string.
         if (containerElement.id) {
             this.baseId = containerElement.id;
@@ -355,7 +355,7 @@ export abstract class AbstractViewer {
             this.observablesManager.onExitingVRObservable.add(() => {
                 if (this._vrToggled) {
                     this._vrToggled = false;
-                    
+
                     // undo the scaling of the model
                     if (this.sceneManager.models.length) {
                         this.sceneManager.models[0].rootMesh.scaling.scaleInPlace(1 / this._vrScale);

+ 4 - 3
Viewer/tests/unit/src/viewer/viewer.ts

@@ -57,13 +57,14 @@ describe('Viewer', function () {
         let viewer: DefaultViewer = <DefaultViewer>Helper.getNewViewerInstance();
         viewer.onInitDoneObservable.add(() => {
             // default visibility is not none
-            expect(viewer.containerElement.style.display).not.to.equal('none');
+            const htmlElement = viewer.containerElement as HTMLElement;
+            expect(htmlElement.style.display).not.to.equal('none');
             viewer.hide().then(() => {
                 // element is hidden
-                assert.equal(viewer.containerElement.style.display, 'none', "Viewer is still visible");
+                assert.equal(htmlElement.style.display, 'none', "Viewer is still visible");
                 viewer.show().then(() => {
                     //element is shown
-                    assert.notEqual(viewer.containerElement.style.display, 'none', "Viewer is not visible");
+                    assert.notEqual(htmlElement.style.display, 'none', "Viewer is not visible");
                     viewer.dispose();
                     done();
                 });

+ 44 - 44
Viewer/tests/validation/index.html

@@ -1,55 +1,55 @@
 <!DOCTYPE html>
 <html>
 
-    <head>
-        <title>BabylonJS - Build validation page</title>
-        <link href="index.css" rel="stylesheet" />
-        <script src="https://preview.babylonjs.com/draco_decoder.js"></script>
-    </head>
-
-    <body>
-        <script>
-            /*BABYLONDEVTOOLS.Loader.require('validation.js')
-                .load(function() {*/
-            // Loading tests
-            var xhr = new XMLHttpRequest();
-
-            xhr.open("GET", "config.json", true);
-
-            xhr.addEventListener("load", function () {
-                if (xhr.status === 200) {
-
-                    config = JSON.parse(xhr.responseText);
-
-                    // Run tests
-                    var index = 0;
-                    if (window.location.search) {
-                        justOnce = true;
-                        var title = window.location.search.replace("?", "").replace(/%20/g, " ");
-                        for (var index = 0; index < config.tests.length; index++) {
-                            if (config.tests[index].title === title) {
-                                break;
-                            }
+<head>
+    <title>BabylonJS - Build validation page</title>
+    <link href="index.css" rel="stylesheet" />
+    <script src="https://preview.babylonjs.com/draco_decoder_gltf.js"></script>
+</head>
+
+<body>
+    <script>
+        /*BABYLONDEVTOOLS.Loader.require('validation.js')
+            .load(function() {*/
+        // Loading tests
+        var xhr = new XMLHttpRequest();
+
+        xhr.open("GET", "config.json", true);
+
+        xhr.addEventListener("load", function () {
+            if (xhr.status === 200) {
+
+                config = JSON.parse(xhr.responseText);
+
+                // Run tests
+                var index = 0;
+                if (window.location.search) {
+                    justOnce = true;
+                    var title = window.location.search.replace("?", "").replace(/%20/g, " ");
+                    for (var index = 0; index < config.tests.length; index++) {
+                        if (config.tests[index].title === title) {
+                            break;
                         }
                     }
+                }
 
-                    var recursiveRunTest = function (i) {
-                        runTest(i, function () {
-                            i++;
-                            if (justOnce || i >= config.tests.length) {
-                                return;
-                            }
-                            recursiveRunTest(i);
-                        });
-                    }
-
-                    recursiveRunTest(index);
+                var recursiveRunTest = function (i) {
+                    runTest(i, function () {
+                        i++;
+                        if (justOnce || i >= config.tests.length) {
+                            return;
+                        }
+                        recursiveRunTest(i);
+                    });
                 }
-            }, false);
 
-            xhr.send();
+                recursiveRunTest(index);
+            }
+        }, false);
+
+        xhr.send();
 			//});
-        </script>
-    </body>
+    </script>
+</body>
 
 </html>

Разница между файлами не показана из-за своего большого размера
+ 9081 - 9061
dist/preview release/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/babylon.js


+ 19 - 4
dist/preview release/babylon.max.js

@@ -12553,7 +12553,10 @@ var BABYLON;
                 if (this._gl.renderbufferStorageMultisample) {
                     this._webGLVersion = 2.0;
                 }
-                options.stencil = this._gl.getContextAttributes().stencil;
+                var attributes = this._gl.getContextAttributes();
+                if (attributes) {
+                    options.stencil = attributes.stencil;
+                }
             }
             // Viewport
             var limitDeviceRatio = options.limitDeviceRatio || window.devicePixelRatio || 1.0;
@@ -14598,6 +14601,9 @@ var BABYLON;
         Engine.prototype._compileRawShader = function (source, type) {
             var gl = this._gl;
             var shader = gl.createShader(type === "vertex" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);
+            if (!shader) {
+                throw new Error("Something went wrong while compile the shader.");
+            }
             gl.shaderSource(shader, source);
             gl.compileShader(shader);
             if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
@@ -14606,9 +14612,6 @@ var BABYLON;
                     throw new Error(log);
                 }
             }
-            if (!shader) {
-                throw new Error("Something went wrong while compile the shader.");
-            }
             return shader;
         };
         /**
@@ -64225,6 +64228,18 @@ var BABYLON;
      */
     var LinesMesh = /** @class */ (function (_super) {
         __extends(LinesMesh, _super);
+        /**
+         * Creates a new LinesMesh
+         * @param name defines the name
+         * @param scene defines the hosting scene
+         * @param parent defines the parent mesh if any
+         * @param source defines the optional source LinesMesh used to clone data from
+         * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
+         * When false, achieved by calling a clone(), also passing False.
+         * This will make creation of children, recursive.
+         * @param useVertexColor defines if this LinesMesh supports vertex color
+         * @param useVertexAlpha defines if this LinesMesh supports vertex alpha
+         */
         function LinesMesh(name, scene, parent, source, doNotCloneChildren, 
         /**
          * If vertex color should be applied to the mesh

+ 19 - 4
dist/preview release/babylon.no-module.max.js

@@ -12520,7 +12520,10 @@ var BABYLON;
                 if (this._gl.renderbufferStorageMultisample) {
                     this._webGLVersion = 2.0;
                 }
-                options.stencil = this._gl.getContextAttributes().stencil;
+                var attributes = this._gl.getContextAttributes();
+                if (attributes) {
+                    options.stencil = attributes.stencil;
+                }
             }
             // Viewport
             var limitDeviceRatio = options.limitDeviceRatio || window.devicePixelRatio || 1.0;
@@ -14565,6 +14568,9 @@ var BABYLON;
         Engine.prototype._compileRawShader = function (source, type) {
             var gl = this._gl;
             var shader = gl.createShader(type === "vertex" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);
+            if (!shader) {
+                throw new Error("Something went wrong while compile the shader.");
+            }
             gl.shaderSource(shader, source);
             gl.compileShader(shader);
             if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
@@ -14573,9 +14579,6 @@ var BABYLON;
                     throw new Error(log);
                 }
             }
-            if (!shader) {
-                throw new Error("Something went wrong while compile the shader.");
-            }
             return shader;
         };
         /**
@@ -64192,6 +64195,18 @@ var BABYLON;
      */
     var LinesMesh = /** @class */ (function (_super) {
         __extends(LinesMesh, _super);
+        /**
+         * Creates a new LinesMesh
+         * @param name defines the name
+         * @param scene defines the hosting scene
+         * @param parent defines the parent mesh if any
+         * @param source defines the optional source LinesMesh used to clone data from
+         * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
+         * When false, achieved by calling a clone(), also passing False.
+         * This will make creation of children, recursive.
+         * @param useVertexColor defines if this LinesMesh supports vertex color
+         * @param useVertexAlpha defines if this LinesMesh supports vertex alpha
+         */
         function LinesMesh(name, scene, parent, source, doNotCloneChildren, 
         /**
          * If vertex color should be applied to the mesh

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/babylon.worker.js


+ 19 - 4
dist/preview release/es6.js

@@ -12520,7 +12520,10 @@ var BABYLON;
                 if (this._gl.renderbufferStorageMultisample) {
                     this._webGLVersion = 2.0;
                 }
-                options.stencil = this._gl.getContextAttributes().stencil;
+                var attributes = this._gl.getContextAttributes();
+                if (attributes) {
+                    options.stencil = attributes.stencil;
+                }
             }
             // Viewport
             var limitDeviceRatio = options.limitDeviceRatio || window.devicePixelRatio || 1.0;
@@ -14565,6 +14568,9 @@ var BABYLON;
         Engine.prototype._compileRawShader = function (source, type) {
             var gl = this._gl;
             var shader = gl.createShader(type === "vertex" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);
+            if (!shader) {
+                throw new Error("Something went wrong while compile the shader.");
+            }
             gl.shaderSource(shader, source);
             gl.compileShader(shader);
             if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
@@ -14573,9 +14579,6 @@ var BABYLON;
                     throw new Error(log);
                 }
             }
-            if (!shader) {
-                throw new Error("Something went wrong while compile the shader.");
-            }
             return shader;
         };
         /**
@@ -64192,6 +64195,18 @@ var BABYLON;
      */
     var LinesMesh = /** @class */ (function (_super) {
         __extends(LinesMesh, _super);
+        /**
+         * Creates a new LinesMesh
+         * @param name defines the name
+         * @param scene defines the hosting scene
+         * @param parent defines the parent mesh if any
+         * @param source defines the optional source LinesMesh used to clone data from
+         * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
+         * When false, achieved by calling a clone(), also passing False.
+         * This will make creation of children, recursive.
+         * @param useVertexColor defines if this LinesMesh supports vertex color
+         * @param useVertexAlpha defines if this LinesMesh supports vertex alpha
+         */
         function LinesMesh(name, scene, parent, source, doNotCloneChildren, 
         /**
          * If vertex color should be applied to the mesh

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js.map


+ 12 - 26
dist/preview release/viewer/babylon.viewer.d.ts

@@ -128,14 +128,14 @@ declare module BabylonViewer {
         * It uses the templating system to render a new canvas and controls.
         */
     export class DefaultViewer extends AbstractViewer {
-            containerElement: HTMLElement;
-            fullscreenElement?: HTMLElement;
+            containerElement: Element;
+            fullscreenElement?: Element;
             /**
                 * Create a new default viewer
                 * @param containerElement the element in which the templates will be rendered
                 * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
                 */
-            constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
+            constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
             registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
             /**
                 * This will be executed when the templates initialize.
@@ -168,11 +168,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -204,7 +204,7 @@ declare module BabylonViewer {
         * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
         */
     export abstract class AbstractViewer {
-            containerElement: HTMLElement;
+            containerElement: Element;
             /**
                 * The corresponsing template manager of this viewer.
                 */
@@ -315,7 +315,7 @@ declare module BabylonViewer {
             protected _isInit: boolean;
             protected _configurationContainer: ConfigurationContainer;
             readonly configurationContainer: ConfigurationContainer;
-            constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
+            constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
             /**
                 * get the baseId of this viewer
                 */
@@ -924,7 +924,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1052,7 +1052,7 @@ declare module BabylonViewer {
         * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
         */
     export class TemplateManager {
-            containerElement: HTMLElement;
+            containerElement: Element;
             /**
                 * Will be triggered when any template is initialized
                 */
@@ -1077,7 +1077,7 @@ declare module BabylonViewer {
                 * This template manager's event manager. In charge of callback registrations to native event types
                 */
             eventManager: EventManager;
-            constructor(containerElement: HTMLElement);
+            constructor(containerElement: Element);
             /**
                 * Initialize the template(s) for the viewer. Called bay the Viewer class
                 * @param templates the templates to be used to initialize the main template
@@ -1558,20 +1558,6 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {

Разница между файлами не показана из-за своего большого размера
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/viewer/babylon.viewer.max.js


+ 12 - 29
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -160,14 +160,14 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
         * It uses the templating system to render a new canvas and controls.
         */
     export class DefaultViewer extends AbstractViewer {
-            containerElement: HTMLElement;
-            fullscreenElement?: HTMLElement;
+            containerElement: Element;
+            fullscreenElement?: Element;
             /**
                 * Create a new default viewer
                 * @param containerElement the element in which the templates will be rendered
                 * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
                 */
-            constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
+            constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
             registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
             /**
                 * This will be executed when the templates initialize.
@@ -200,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -246,7 +246,7 @@ declare module 'babylonjs-viewer/viewer/viewer' {
         * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
         */
     export abstract class AbstractViewer {
-            containerElement: HTMLElement;
+            containerElement: Element;
             /**
                 * The corresponsing template manager of this viewer.
                 */
@@ -357,7 +357,7 @@ declare module 'babylonjs-viewer/viewer/viewer' {
             protected _isInit: boolean;
             protected _configurationContainer: ConfigurationContainer;
             readonly configurationContainer: ConfigurationContainer;
-            constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
+            constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
             /**
                 * get the baseId of this viewer
                 */
@@ -985,14 +985,13 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
-    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
       *
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1132,7 +1131,7 @@ declare module 'babylonjs-viewer/templating/templateManager' {
         * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
         */
     export class TemplateManager {
-            containerElement: HTMLElement;
+            containerElement: Element;
             /**
                 * Will be triggered when any template is initialized
                 */
@@ -1157,7 +1156,7 @@ declare module 'babylonjs-viewer/templating/templateManager' {
                 * This template manager's event manager. In charge of callback registrations to native event types
                 */
             eventManager: EventManager;
-            constructor(containerElement: HTMLElement);
+            constructor(containerElement: Element);
             /**
                 * Initialize the template(s) for the viewer. Called bay the Viewer class
                 * @param templates the templates to be used to initialize the main template
@@ -1663,22 +1662,6 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
-declare module 'babylonjs-viewer/optimizer/custom/extended' {
-    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

+ 1 - 1
gui/package.json

@@ -27,7 +27,7 @@
         "@types/node": "^10.5.2",
         "clean-webpack-plugin": "^0.1.19",
         "ts-loader": "^4.0.0",
-        "typescript": "^3.0.1",
+        "typescript": "~3.0.1",
         "webpack": "^4.16.0",
         "webpack-cli": "^3.0.8",
         "webpack-dev-server": "^3.1.4"

+ 1 - 1
inspector/package.json

@@ -33,7 +33,7 @@
         "sass-loader": "^7.0.3",
         "style-loader": "^0.21.0",
         "ts-loader": "^4.0.0",
-        "typescript": "^3.0.1",
+        "typescript": "~3.0.1",
         "webpack": "^4.16.2",
         "webpack-cli": "^3.1.0",
         "webpack-dev-server": "^3.1.5"

+ 4 - 1
inspector/src/Inspector.ts

@@ -405,7 +405,10 @@ export class Inspector {
             let link = popup.document.createElement("link");
             link.rel = "stylesheet";
             link.href = (links[l] as HTMLLinkElement).href;
-            popup.document.head.appendChild(link);
+
+            if (popup.document.head) {
+                popup.document.head.appendChild(link);
+            }
         }
         // Dispose the right panel if existing
         if (!firstTime) {

+ 1 - 1
inspector/src/scheduler/Scheduler.ts

@@ -17,7 +17,7 @@ export class Scheduler {
     private interval: number;
 
     constructor() {
-        this.interval = setInterval(this._update.bind(this), Scheduler.REFRESH_TIME);
+        this.interval = window.setInterval(this._update.bind(this), Scheduler.REFRESH_TIME);
     }
 
     public static getInstance(): Scheduler {

+ 2 - 2
package.json

@@ -41,6 +41,6 @@
     "dependencies": {},
     "devDependencies": {
         "base64-font-loader": "0.0.4",
-        "typescript": "^3.0.1"
+        "typescript": "~3.0.1"
     }
-}
+}

+ 1 - 1
src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

@@ -71,7 +71,7 @@ module BABYLON {
         private _onGesture: Nullable<(e: MSGestureEvent) => void>;
         private _MSGestureHandler: Nullable<MSGesture>;
         private _onLostFocus: Nullable<(e: FocusEvent) => any>;
-        private _onContextMenu: Nullable<(e: PointerEvent) => void>;
+        private _onContextMenu: Nullable<(e: Event) => void>;
 
         /**
          * Attach the input controls to a specific dom element to get the input from.

+ 63 - 60
src/Engine/babylon.engine.ts

@@ -1118,7 +1118,10 @@ module BABYLON {
                     this._webGLVersion = 2.0;
                 }
 
-                options.stencil = this._gl.getContextAttributes().stencil;
+                const attributes = this._gl.getContextAttributes();
+                if (attributes) {
+                    options.stencil = attributes.stencil;
+                }
             }
 
             // Viewport
@@ -1858,7 +1861,7 @@ module BABYLON {
                 // Register new frame
                 var requester = null;
                 if (this._vrDisplay && this._vrDisplay.isPresenting) {
-                    requester = this._vrDisplay;
+                    requester = this._vrDisplay;
                 }
                 this._frameHandler = Tools.QueueNewFrame(this._bindedRenderFunction, requester);
             } else {
@@ -1964,8 +1967,7 @@ module BABYLON {
             if (x !== this._viewportCached.x ||
                 y !== this._viewportCached.y ||
                 width !== this._viewportCached.z ||
-                height !== this._viewportCached.w)
-            {
+                height !== this._viewportCached.w) {
                 this._viewportCached.x = x;
                 this._viewportCached.y = y;
                 this._viewportCached.z = width;
@@ -2120,7 +2122,7 @@ module BABYLON {
                     vrSupported: this._vrSupported
                 };
                 this.onVRDisplayChangedObservable.notifyObservers(eventArgs);
-                this._webVRInitPromise = new Promise((res) => {res(eventArgs); });
+                this._webVRInitPromise = new Promise((res) => { res(eventArgs); });
             };
 
             if (!this._onVrDisplayConnect) {
@@ -3220,6 +3222,10 @@ module BABYLON {
             var gl = this._gl;
             var shader = gl.createShader(type === "vertex" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);
 
+            if (!shader) {
+                throw new Error("Something went wrong while compile the shader.");
+            }
+
             gl.shaderSource(shader, source);
             gl.compileShader(shader);
 
@@ -3230,10 +3236,6 @@ module BABYLON {
                 }
             }
 
-            if (!shader) {
-                throw new Error("Something went wrong while compile the shader.");
-            }
-
             return shader;
         }
 
@@ -3395,7 +3397,7 @@ module BABYLON {
          */
         public setIntArray(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform1iv(uniform, array);
@@ -3408,7 +3410,7 @@ module BABYLON {
          */
         public setIntArray2(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void {
             if (!uniform || array.length % 2 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform2iv(uniform, array);
@@ -3421,7 +3423,7 @@ module BABYLON {
          */
         public setIntArray3(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void {
             if (!uniform || array.length % 3 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform3iv(uniform, array);
@@ -3434,7 +3436,7 @@ module BABYLON {
          */
         public setIntArray4(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void {
             if (!uniform || array.length % 4 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform4iv(uniform, array);
@@ -3447,7 +3449,7 @@ module BABYLON {
          */
         public setFloatArray(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform1fv(uniform, array);
@@ -3460,7 +3462,7 @@ module BABYLON {
          */
         public setFloatArray2(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void {
             if (!uniform || array.length % 2 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform2fv(uniform, array);
@@ -3473,7 +3475,7 @@ module BABYLON {
          */
         public setFloatArray3(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void {
             if (!uniform || array.length % 3 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform3fv(uniform, array);
@@ -3486,7 +3488,7 @@ module BABYLON {
          */
         public setFloatArray4(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void {
             if (!uniform || array.length % 4 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform4fv(uniform, array);
@@ -3499,7 +3501,7 @@ module BABYLON {
          */
         public setArray(uniform: Nullable<WebGLUniformLocation>, array: number[]): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform1fv(uniform, <any>array);
@@ -3512,7 +3514,7 @@ module BABYLON {
          */
         public setArray2(uniform: Nullable<WebGLUniformLocation>, array: number[]): void {
             if (!uniform || array.length % 2 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform2fv(uniform, <any>array);
@@ -3525,7 +3527,7 @@ module BABYLON {
          */
         public setArray3(uniform: Nullable<WebGLUniformLocation>, array: number[]): void {
             if (!uniform || array.length % 3 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform3fv(uniform, <any>array);
@@ -3538,7 +3540,7 @@ module BABYLON {
          */
         public setArray4(uniform: Nullable<WebGLUniformLocation>, array: number[]): void {
             if (!uniform || array.length % 4 !== 0) {
-                return;
+                return;
             }
 
             this._gl.uniform4fv(uniform, <any>array);
@@ -3551,7 +3553,7 @@ module BABYLON {
          */
         public setMatrices(uniform: Nullable<WebGLUniformLocation>, matrices: Float32Array): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniformMatrix4fv(uniform, false, matrices);
@@ -3564,7 +3566,7 @@ module BABYLON {
          */
         public setMatrix(uniform: Nullable<WebGLUniformLocation>, matrix: Matrix): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniformMatrix4fv(uniform, false, matrix.toArray());
@@ -3577,7 +3579,7 @@ module BABYLON {
          */
         public setMatrix3x3(uniform: Nullable<WebGLUniformLocation>, matrix: Float32Array): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniformMatrix3fv(uniform, false, matrix);
@@ -3590,7 +3592,7 @@ module BABYLON {
          */
         public setMatrix2x2(uniform: Nullable<WebGLUniformLocation>, matrix: Float32Array): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniformMatrix2fv(uniform, false, matrix);
@@ -3603,7 +3605,7 @@ module BABYLON {
          */
         public setInt(uniform: Nullable<WebGLUniformLocation>, value: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform1i(uniform, value);
@@ -3616,7 +3618,7 @@ module BABYLON {
          */
         public setFloat(uniform: Nullable<WebGLUniformLocation>, value: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform1f(uniform, value);
@@ -3630,7 +3632,7 @@ module BABYLON {
          */
         public setFloat2(uniform: Nullable<WebGLUniformLocation>, x: number, y: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform2f(uniform, x, y);
@@ -3645,7 +3647,7 @@ module BABYLON {
          */
         public setFloat3(uniform: Nullable<WebGLUniformLocation>, x: number, y: number, z: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform3f(uniform, x, y, z);
@@ -3658,7 +3660,7 @@ module BABYLON {
          */
         public setBool(uniform: Nullable<WebGLUniformLocation>, bool: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform1i(uniform, bool);
@@ -3674,7 +3676,7 @@ module BABYLON {
          */
         public setFloat4(uniform: Nullable<WebGLUniformLocation>, x: number, y: number, z: number, w: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform4f(uniform, x, y, z, w);
@@ -3687,7 +3689,7 @@ module BABYLON {
          */
         public setColor3(uniform: Nullable<WebGLUniformLocation>, color3: Color3): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform3f(uniform, color3.r, color3.g, color3.b);
@@ -3701,7 +3703,7 @@ module BABYLON {
          */
         public setColor4(uniform: Nullable<WebGLUniformLocation>, color3: Color3, alpha: number): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform4f(uniform, color3.r, color3.g, color3.b, alpha);
@@ -3714,7 +3716,7 @@ module BABYLON {
          */
         public setDirectColor4(uniform: Nullable<WebGLUniformLocation>, color4: Color4): void {
             if (!uniform) {
-                return;
+                return;
             }
 
             this._gl.uniform4f(uniform, color4.r, color4.g, color4.b, color4.a);
@@ -4218,9 +4220,9 @@ module BABYLON {
                 var callback = (data: string | ArrayBuffer) => {
                     loader!.loadData(data as ArrayBuffer, texture, (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void) => {
                         this._prepareWebGLTexture(texture, scene, width, height, invertY, !loadMipmap, isCompressed, () => {
-                                done();
-                                return false;
-                            },
+                            done();
+                            return false;
+                        },
                             samplingMode);
                     });
                 };
@@ -4359,7 +4361,8 @@ module BABYLON {
          * @param compression defines the compression used (null by default)
          * @param type defines the type fo the data (BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT by default)
          */
-        public updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string> = null, type = Engine.TEXTURETYPE_UNSIGNED_INT): void {            if (!texture) {
+        public updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string> = null, type = Engine.TEXTURETYPE_UNSIGNED_INT): void {
+            if (!texture) {
                 return;
             }
             // babylon's internalSizedFomat but gl's texImage2D internalFormat
@@ -4669,7 +4672,7 @@ module BABYLON {
             texture._comparisonFunction = comparisonFunction;
         }
 
-        private _setupDepthStencilTexture(internalTexture: InternalTexture, size: number | { width: number, height: number }, generateStencil: boolean, bilinearFiltering: boolean, comparisonFunction: number) : void {
+        private _setupDepthStencilTexture(internalTexture: InternalTexture, size: number | { width: number, height: number }, generateStencil: boolean, bilinearFiltering: boolean, comparisonFunction: number): void {
             var width = (<{ width: number, height: number }>size).width || <number>size;
             var height = (<{ width: number, height: number }>size).height || <number>size;
             internalTexture.baseWidth = width;
@@ -4710,7 +4713,7 @@ module BABYLON {
          * @param options The options defining the texture.
          * @returns The texture
          */
-        public createDepthStencilTexture(size: number | { width: number, height: number }, options: DepthTextureCreationOptions) : InternalTexture {
+        public createDepthStencilTexture(size: number | { width: number, height: number }, options: DepthTextureCreationOptions): InternalTexture {
             if (options.isCube) {
                 let width = (<{ width: number, height: number }>size).width || <number>size;
                 return this._createDepthStencilCubeTexture(width, options);
@@ -4727,7 +4730,7 @@ module BABYLON {
          * @param options The options defining the texture.
          * @returns The texture
          */
-        private _createDepthStencilTexture(size: number | { width: number, height: number }, options: DepthTextureCreationOptions) : InternalTexture {
+        private _createDepthStencilTexture(size: number | { width: number, height: number }, options: DepthTextureCreationOptions): InternalTexture {
             var internalTexture = new InternalTexture(this, InternalTexture.DATASOURCE_DEPTHTEXTURE);
 
             if (!this._caps.depthTextureExtension) {
@@ -4776,7 +4779,7 @@ module BABYLON {
          * @param options The options defining the cube texture.
          * @returns The cube texture
          */
-        private _createDepthStencilCubeTexture(size: number, options: DepthTextureCreationOptions) : InternalTexture {
+        private _createDepthStencilCubeTexture(size: number, options: DepthTextureCreationOptions): InternalTexture {
             var internalTexture = new InternalTexture(this, InternalTexture.DATASOURCE_UNKNOWN);
             internalTexture.isCube = true;
 
@@ -5368,23 +5371,23 @@ module BABYLON {
          */
         public createRenderTargetCubeTexture(size: number, options?: Partial<RenderTargetCreationOptions>): InternalTexture {
             let fullOptions = {
-              generateMipMaps: true,
-              generateDepthBuffer: true,
-              generateStencilBuffer: false,
-              type: Engine.TEXTURETYPE_UNSIGNED_INT,
-              samplingMode: Engine.TEXTURE_TRILINEAR_SAMPLINGMODE,
-              format: Engine.TEXTUREFORMAT_RGBA,
-              ...options
+                generateMipMaps: true,
+                generateDepthBuffer: true,
+                generateStencilBuffer: false,
+                type: Engine.TEXTURETYPE_UNSIGNED_INT,
+                samplingMode: Engine.TEXTURE_TRILINEAR_SAMPLINGMODE,
+                format: Engine.TEXTUREFORMAT_RGBA,
+                ...options
             };
             fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;
 
             if (fullOptions.type === Engine.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {
-              // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
-              fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
+                // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
+                fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
             }
             else if (fullOptions.type === Engine.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {
-              // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
-              fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
+                // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
+                fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
             }
             var gl = this._gl;
 
@@ -5394,8 +5397,8 @@ module BABYLON {
             var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);
 
             if (fullOptions.type === Engine.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {
-              fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;
-              Tools.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type");
+                fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;
+                Tools.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type");
             }
 
             gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
@@ -5415,7 +5418,7 @@ module BABYLON {
 
             // MipMaps
             if (fullOptions.generateMipMaps) {
-              gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+                gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
             }
 
             // Unbind
@@ -5769,8 +5772,8 @@ module BABYLON {
          * @returns the cube texture as an InternalTexture
          */
         public createRawCubeTexture(data: Nullable<ArrayBufferView[]>, size: number, format: number, type: number,
-                                    generateMipMaps: boolean, invertY: boolean, samplingMode: number,
-                                    compression: Nullable<string> = null): InternalTexture {
+            generateMipMaps: boolean, invertY: boolean, samplingMode: number,
+            compression: Nullable<string> = null): InternalTexture {
             var gl = this._gl;
             var texture = new InternalTexture(this, InternalTexture.DATASOURCE_CUBERAW);
             texture.isCube = true;
@@ -6889,7 +6892,7 @@ module BABYLON {
          */
         public get loadingScreen(): ILoadingScreen {
             if (!this._loadingScreen && DefaultLoadingScreen && this._renderingCanvas) {
-                this._loadingScreen = new DefaultLoadingScreen(this._renderingCanvas);
+                this._loadingScreen = new DefaultLoadingScreen(this._renderingCanvas);
             }
             return this._loadingScreen;
         }
@@ -7264,7 +7267,7 @@ module BABYLON {
                             return this._gl.RGBA8UI;
                         default:
                             return this._gl.RGBA8;
-                        }
+                    }
                 case Engine.TEXTURETYPE_SHORT:
                     switch (format) {
                         case Engine.TEXTUREFORMAT_RED_INTEGER:

+ 12 - 0
src/Mesh/babylon.linesMesh.ts

@@ -41,6 +41,18 @@ module BABYLON {
         private _intersectionThreshold: number;
         private _colorShader: ShaderMaterial;
 
+        /**
+         * Creates a new LinesMesh
+         * @param name defines the name
+         * @param scene defines the hosting scene
+         * @param parent defines the parent mesh if any
+         * @param source defines the optional source LinesMesh used to clone data from
+         * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
+         * When false, achieved by calling a clone(), also passing False.
+         * This will make creation of children, recursive.
+         * @param useVertexColor defines if this LinesMesh supports vertex color
+         * @param useVertexAlpha defines if this LinesMesh supports vertex alpha
+         */
         constructor(
             name: string,
             scene: Nullable<Scene> = null,

+ 1 - 1
src/Tools/babylon.assetsManager.ts

@@ -431,7 +431,7 @@ module BABYLON {
                 onSuccess();
             };
 
-            img.onerror = (err: ErrorEvent): any => {
+            img.onerror = (err: string | Event): any => {
                 onError("Error loading image", err);
             };
 

+ 21 - 21
src/Tools/babylon.tools.ts

@@ -158,7 +158,7 @@ module BABYLON {
 
     var cloneValue = (source: any, destinationObject: any) => {
         if (!source) {
-            return null;
+            return null;
         }
 
         if (source instanceof Mesh) {
@@ -400,7 +400,7 @@ module BABYLON {
         public static GetFilename(path: string): string {
             var index = path.lastIndexOf("/");
             if (index < 0) {
-                return path;
+                return path;
             }
 
             return path.substring(index + 1);
@@ -549,13 +549,13 @@ module BABYLON {
                 stride = 3;
             }
 
-            for (var index = start, offset = start * stride; index < start + count; index++, offset += stride) {
+            for (var index = start, offset = start * stride; index < start + count; index++ , offset += stride) {
                 const x = positions[offset];
                 const y = positions[offset + 1];
                 const z = positions[offset + 2];
                 minimum.minimizeInPlaceFromFloats(x, y, z);
                 maximum.maximizeInPlaceFromFloats(x, y, z);
-              }
+            }
 
             if (bias) {
                 minimum.x -= minimum.x * bias.x + bias.y;
@@ -580,7 +580,7 @@ module BABYLON {
          */
         public static MakeArray(obj: any, allowsNullUndefined?: boolean): Nullable<Array<any>> {
             if (allowsNullUndefined !== true && (obj === undefined || obj == null)) {
-                return null;
+                return null;
             }
 
             return Array.isArray(obj) ? obj : [obj];
@@ -641,7 +641,7 @@ module BABYLON {
          * @param element defines the DOM element to promote
          */
         public static RequestFullscreen(element: HTMLElement): void {
-            var requestFunction = element.requestFullscreen || (<any>element).msRequestFullscreen || element.webkitRequestFullscreen || (<any>element).mozRequestFullScreen;
+            var requestFunction = element.requestFullscreen || (<any>element).msRequestFullscreen || (<any>element).webkitRequestFullscreen || (<any>element).mozRequestFullScreen;
             if (!requestFunction) { return; }
             requestFunction.call(element);
         }
@@ -960,13 +960,13 @@ module BABYLON {
             return fileRequest;
         }
 
-         /**
-          * Load a script (identified by an url). When the url returns, the
-          * content of this file is added into a new script element, attached to the DOM (body element)
-          * @param scriptUrl defines the url of the script to laod
-          * @param onSuccess defines the callback called when the script is loaded
-          * @param onError defines the callback to call if an error occurs
-          */
+        /**
+         * Load a script (identified by an url). When the url returns, the
+         * content of this file is added into a new script element, attached to the DOM (body element)
+         * @param scriptUrl defines the url of the script to laod
+         * @param onSuccess defines the callback called when the script is loaded
+         * @param onError defines the callback to call if an error occurs
+         */
         public static LoadScript(scriptUrl: string, onSuccess: () => void, onError?: (message?: string, exception?: any) => void) {
             if (!Tools.IsWindowObjectExist()) {
                 return;
@@ -1090,23 +1090,23 @@ module BABYLON {
          */
         public static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void {
             if (v.x < min.x) {
-                min.x = v.x;
+                min.x = v.x;
             }
             if (v.y < min.y) {
-                min.y = v.y;
+                min.y = v.y;
             }
             if (v.z < min.z) {
-                min.z = v.z;
+                min.z = v.z;
             }
 
             if (v.x > max.x) {
-                max.x = v.x;
+                max.x = v.x;
             }
             if (v.y > max.y) {
-                max.y = v.y;
+                max.y = v.y;
             }
             if (v.z > max.z) {
-                max.z = v.z;
+                max.z = v.z;
             }
         }
 
@@ -1973,10 +1973,10 @@ module BABYLON {
                 let nextGradient = gradients[gradientIndex + 1];
 
                 if (ratio >= currentGradient.gradient && ratio <= nextGradient.gradient) {
-                    let scale =  (ratio - currentGradient.gradient) / (nextGradient.gradient - currentGradient.gradient);
+                    let scale = (ratio - currentGradient.gradient) / (nextGradient.gradient - currentGradient.gradient);
                     updateFunc(currentGradient, nextGradient, scale);
                     return;
-               }
+                }
             }
 
             // Use last index if over

+ 11 - 2
src/babylon.mixins.ts

@@ -19,6 +19,7 @@ interface Window {
     msURL: typeof URL;
     VRFrameData: any; // WebVR, from specs 1.1
     DracoDecoderModule: any;
+    setImmediate(handler: (...args: any[]) => void): number;
 }
 
 interface WebGLRenderingContext {
@@ -87,15 +88,20 @@ interface WebGLRenderingContext {
 interface Document {
     mozCancelFullScreen(): void;
     msCancelFullScreen(): void;
+    webkitCancelFullScreen(): void;
+    requestPointerLock(): void;
+    exitPointerLock(): void;
     mozFullScreen: boolean;
     msIsFullScreen: boolean;
-    fullscreen: boolean;
+    readonly webkitIsFullScreen: boolean;
+    readonly pointerLockElement: Element;
     mozPointerLockElement: HTMLElement;
     msPointerLockElement: HTMLElement;
     webkitPointerLockElement: HTMLElement;
 }
 
 interface HTMLCanvasElement {
+    requestPointerLock(): void;
     msRequestPointerLock?(): void;
     mozRequestPointerLock?(): void;
     webkitRequestPointerLock?(): void;
@@ -140,8 +146,11 @@ interface HTMLVideoElement {
     mozSrcObject: any;
 }
 
+interface Element {
+    webkitRequestFullScreen: () => void;
+}
+
 interface Screen {
-    orientation: string;
     mozOrientation: string;
 }