Explorar o código

Fix WebRequest references (There were quite a lot!)

David Catuhe %!s(int64=6) %!d(string=hai) anos
pai
achega
9b53f27e50

+ 99 - 12
Playground/babylon.d.txt

@@ -4962,7 +4962,8 @@ declare module BABYLON {
     /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest extends XMLHttpRequest {
+    export class WebRequest {
+        private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
          * i.e. when loading files, where the server/service expects an Authorization header
@@ -4973,8 +4974,58 @@ declare module BABYLON {
         /**
          * Add callback functions in this array to update all the requests before they get sent to the network
          */
-        static CustomRequestModifiers: ((request: WebRequest) => void)[];
+        static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[];
         private _injectCustomRequestHeaders;
+        /**
+         * Gets or sets a function to be called when loading progress changes
+         */
+        onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
+        /**
+         * Returns client's state
+         */
+        readonly readyState: number;
+        /**
+         * Returns client's status
+         */
+        readonly status: number;
+        /**
+         * Returns client's status as a text
+         */
+        readonly statusText: string;
+        /**
+         * Returns client's response
+         */
+        readonly response: any;
+        /**
+         * Returns client's response url
+         */
+        readonly responseURL: string;
+        /**
+         * Returns client's response as text
+         */
+        readonly responseText: string;
+        /**
+         * Gets or sets the expected response type
+         */
+        responseType: XMLHttpRequestResponseType;
+        /** @hidden */
+        addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+        /** @hidden */
+        removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+        /**
+         * Cancels any network activity
+         */
+        abort(): void;
+        /**
+         * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+         * @param body defines an optional request body
+         */
+        send(body?: Document | BodyInit | null): void;
+        /**
+         * Sets the request method, request URL
+         * @param method defines the method to use (GET, POST, etc..)
+         * @param url defines the url to connect with
+         */
         open(method: string, url: string): void;
     }
 }
@@ -27789,7 +27840,7 @@ declare module BABYLON {
         private _getInternalFormat;
         /** @hidden */
getRGBABufferInternalSizedFormat(type: number, format?: number): number;
         /** @hidden */
getRGBAMultiSampleBufferFormat(type: number): number;
-        /** @hidden */
loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        /** @hidden */
loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
loadFileAsync(url: string, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
         private _partialLoadFile;
         private _cascadeLoadFiles;
@@ -29548,17 +29599,17 @@ declare module BABYLON {
      * Application error to support additional information when loading a file
      */
     export class LoadFileError extends Error {
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined;
+        /** defines the optional web request */
+        request?: WebRequest | undefined;
         private static _setPrototypeOf;
         /**
          * Creates a new LoadFileError
          * @param message defines the message of the error
-         * @param request defines the optional XHR request
+         * @param request defines the optional web request
          */
         constructor(message: string, 
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined);
+        /** defines the optional web request */
+        request?: WebRequest | undefined);
     }
     /**
      * Class used to define a retry strategy when error happens while loading assets
@@ -29570,7 +29621,7 @@ declare module BABYLON {
          * @param baseInterval defines the interval between retries
          * @returns the strategy function to use
          */
-        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: WebRequest, retryIndex: number) => number;
     }
     /**
      * File request interface
@@ -29609,7 +29660,7 @@ declare module BABYLON {
         /**
          * Gets or sets the retry strategy to apply when an error happens while loading an asset
          */
-        static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;
         /**
          * Default behaviour for cors in the application.
          * It can be a string if the expected behavior is identical in the entire app.
@@ -29837,7 +29888,7 @@ declare module BABYLON {
          * @param onError callback called when the file fails to load
          * @returns a file request object
          */
-        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /**
          * 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)
@@ -32246,7 +32297,7 @@ declare module BABYLON {
          * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty
          */
         markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
-        /** @hidden */
loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        /** @hidden */
loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
loadFileAsync(url: string, useOfflineSupport?: boolean, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
     }
 }
@@ -53016,6 +53067,42 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
+     */
+    export class MeshExploder {
+        private _centerMesh;
+        private _meshes;
+        private _meshesOrigins;
+        private _toCenterVectors;
+        private _scaledDirection;
+        private _newPosition;
+        private _centerPosition;
+        /**
+         * Explodes meshes from a center mesh.
+         * @param meshes The meshes to explode.
+         * @param centerMesh The mesh to be center of explosion.
+         */
+        constructor(meshes: Array<Mesh>, centerMesh?: Mesh);
+        private _setCenterMesh;
+        /**
+         * Get class name
+         * @returns "MeshExploder"
+         */
+        getClassName(): string;
+        /**
+         * "Exploded meshes"
+         * @returns Array of meshes with the centerMesh at index 0.
+         */
+        getMeshes(): Array<Mesh>;
+        /**
+         * Explodes meshes giving a specific direction
+         * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
+         */
+        explode(direction?: number): void;
+    }
+}
+declare module BABYLON {
+    /**
      * Class used to help managing file picking and drag'n'drop
      */
     export class FilesInput {

+ 99 - 12
dist/preview release/babylon.d.ts

@@ -4965,7 +4965,8 @@ declare module BABYLON {
     /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest extends XMLHttpRequest {
+    export class WebRequest {
+        private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
          * i.e. when loading files, where the server/service expects an Authorization header
@@ -4976,8 +4977,58 @@ declare module BABYLON {
         /**
          * Add callback functions in this array to update all the requests before they get sent to the network
          */
-        static CustomRequestModifiers: ((request: WebRequest) => void)[];
+        static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[];
         private _injectCustomRequestHeaders;
+        /**
+         * Gets or sets a function to be called when loading progress changes
+         */
+        onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
+        /**
+         * Returns client's state
+         */
+        readonly readyState: number;
+        /**
+         * Returns client's status
+         */
+        readonly status: number;
+        /**
+         * Returns client's status as a text
+         */
+        readonly statusText: string;
+        /**
+         * Returns client's response
+         */
+        readonly response: any;
+        /**
+         * Returns client's response url
+         */
+        readonly responseURL: string;
+        /**
+         * Returns client's response as text
+         */
+        readonly responseText: string;
+        /**
+         * Gets or sets the expected response type
+         */
+        responseType: XMLHttpRequestResponseType;
+        /** @hidden */
+        addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+        /** @hidden */
+        removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+        /**
+         * Cancels any network activity
+         */
+        abort(): void;
+        /**
+         * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+         * @param body defines an optional request body
+         */
+        send(body?: Document | BodyInit | null): void;
+        /**
+         * Sets the request method, request URL
+         * @param method defines the method to use (GET, POST, etc..)
+         * @param url defines the url to connect with
+         */
         open(method: string, url: string): void;
     }
 }
@@ -28250,7 +28301,7 @@ declare module BABYLON {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
         private _partialLoadFile;
@@ -30060,17 +30111,17 @@ declare module BABYLON {
      * Application error to support additional information when loading a file
      */
     export class LoadFileError extends Error {
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined;
+        /** defines the optional web request */
+        request?: WebRequest | undefined;
         private static _setPrototypeOf;
         /**
          * Creates a new LoadFileError
          * @param message defines the message of the error
-         * @param request defines the optional XHR request
+         * @param request defines the optional web request
          */
         constructor(message: string, 
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined);
+        /** defines the optional web request */
+        request?: WebRequest | undefined);
     }
     /**
      * Class used to define a retry strategy when error happens while loading assets
@@ -30082,7 +30133,7 @@ declare module BABYLON {
          * @param baseInterval defines the interval between retries
          * @returns the strategy function to use
          */
-        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: WebRequest, retryIndex: number) => number;
     }
     /**
      * File request interface
@@ -30121,7 +30172,7 @@ declare module BABYLON {
         /**
          * Gets or sets the retry strategy to apply when an error happens while loading an asset
          */
-        static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;
         /**
          * Default behaviour for cors in the application.
          * It can be a string if the expected behavior is identical in the entire app.
@@ -30349,7 +30400,7 @@ declare module BABYLON {
          * @param onError callback called when the file fails to load
          * @returns a file request object
          */
-        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /**
          * 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)
@@ -32817,7 +32868,7 @@ declare module BABYLON {
          */
         markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, useOfflineSupport?: boolean, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
     }
@@ -53737,6 +53788,42 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
+     */
+    export class MeshExploder {
+        private _centerMesh;
+        private _meshes;
+        private _meshesOrigins;
+        private _toCenterVectors;
+        private _scaledDirection;
+        private _newPosition;
+        private _centerPosition;
+        /**
+         * Explodes meshes from a center mesh.
+         * @param meshes The meshes to explode.
+         * @param centerMesh The mesh to be center of explosion.
+         */
+        constructor(meshes: Array<Mesh>, centerMesh?: Mesh);
+        private _setCenterMesh;
+        /**
+         * Get class name
+         * @returns "MeshExploder"
+         */
+        getClassName(): string;
+        /**
+         * "Exploded meshes"
+         * @returns Array of meshes with the centerMesh at index 0.
+         */
+        getMeshes(): Array<Mesh>;
+        /**
+         * Explodes meshes giving a specific direction
+         * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
+         */
+        explode(direction?: number): void;
+    }
+}
+declare module BABYLON {
+    /**
      * Class used to help managing file picking and drag'n'drop
      */
     export class FilesInput {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/babylon.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 355 - 117
dist/preview release/babylon.max.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 204 - 24
dist/preview release/babylon.module.d.ts

@@ -4967,7 +4967,8 @@ declare module "babylonjs/Misc/webRequest" {
     /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest extends XMLHttpRequest {
+    export class WebRequest {
+        private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
          * i.e. when loading files, where the server/service expects an Authorization header
@@ -4978,8 +4979,58 @@ declare module "babylonjs/Misc/webRequest" {
         /**
          * Add callback functions in this array to update all the requests before they get sent to the network
          */
-        static CustomRequestModifiers: ((request: WebRequest) => void)[];
+        static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[];
         private _injectCustomRequestHeaders;
+        /**
+         * Gets or sets a function to be called when loading progress changes
+         */
+        onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
+        /**
+         * Returns client's state
+         */
+        readonly readyState: number;
+        /**
+         * Returns client's status
+         */
+        readonly status: number;
+        /**
+         * Returns client's status as a text
+         */
+        readonly statusText: string;
+        /**
+         * Returns client's response
+         */
+        readonly response: any;
+        /**
+         * Returns client's response url
+         */
+        readonly responseURL: string;
+        /**
+         * Returns client's response as text
+         */
+        readonly responseText: string;
+        /**
+         * Gets or sets the expected response type
+         */
+        responseType: XMLHttpRequestResponseType;
+        /** @hidden */
+        addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+        /** @hidden */
+        removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+        /**
+         * Cancels any network activity
+         */
+        abort(): void;
+        /**
+         * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+         * @param body defines an optional request body
+         */
+        send(body?: Document | BodyInit | null): void;
+        /**
+         * Sets the request method, request URL
+         * @param method defines the method to use (GET, POST, etc..)
+         * @param url defines the url to connect with
+         */
         open(method: string, url: string): void;
     }
 }
@@ -26826,6 +26877,7 @@ declare module "babylonjs/Engines/engine" {
     import { ILoadingScreen } from "babylonjs/Loading/loadingScreen";
     import { _DepthCullingState, _StencilState, _AlphaState } from "babylonjs/States/index";
     import { RenderTargetCreationOptions } from "babylonjs/Materials/Textures/renderTargetCreationOptions";
+    import { WebRequest } from "babylonjs/Misc/webRequest";
     import { PostProcess } from "babylonjs/PostProcesses/postProcess";
     import { RenderTargetTexture } from "babylonjs/Materials/Textures/renderTargetTexture";
     /**
@@ -28940,7 +28992,7 @@ declare module "babylonjs/Engines/engine" {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
         private _partialLoadFile;
@@ -30697,6 +30749,7 @@ declare module "babylonjs/Misc/tools" {
     import { IOfflineProvider } from "babylonjs/Offline/IOfflineProvider";
     import { Observable } from "babylonjs/Misc/observable";
     import { DomManagement } from "babylonjs/Misc/domManagement";
+    import { WebRequest } from "babylonjs/Misc/webRequest";
     import { Camera } from "babylonjs/Cameras/camera";
     import { Engine } from "babylonjs/Engines/engine";
     import { Animation } from "babylonjs/Animations/animation";
@@ -30793,17 +30846,17 @@ declare module "babylonjs/Misc/tools" {
      * Application error to support additional information when loading a file
      */
     export class LoadFileError extends Error {
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined;
+        /** defines the optional web request */
+        request?: WebRequest | undefined;
         private static _setPrototypeOf;
         /**
          * Creates a new LoadFileError
          * @param message defines the message of the error
-         * @param request defines the optional XHR request
+         * @param request defines the optional web request
          */
         constructor(message: string, 
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined);
+        /** defines the optional web request */
+        request?: WebRequest | undefined);
     }
     /**
      * Class used to define a retry strategy when error happens while loading assets
@@ -30815,7 +30868,7 @@ declare module "babylonjs/Misc/tools" {
          * @param baseInterval defines the interval between retries
          * @returns the strategy function to use
          */
-        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: WebRequest, retryIndex: number) => number;
     }
     /**
      * File request interface
@@ -30854,7 +30907,7 @@ declare module "babylonjs/Misc/tools" {
         /**
          * Gets or sets the retry strategy to apply when an error happens while loading an asset
          */
-        static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;
         /**
          * Default behaviour for cors in the application.
          * It can be a string if the expected behavior is identical in the entire app.
@@ -31082,7 +31135,7 @@ declare module "babylonjs/Misc/tools" {
          * @param onError callback called when the file fails to load
          * @returns a file request object
          */
-        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /**
          * 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)
@@ -31794,6 +31847,7 @@ declare module "babylonjs/scene" {
     import { Node } from "babylonjs/node";
     import { MorphTarget } from "babylonjs/Morph/morphTarget";
     import { AbstractActionManager } from "babylonjs/Actions/abstractActionManager";
+    import { WebRequest } from "babylonjs/Misc/webRequest";
     import { Ray } from "babylonjs/Culling/ray";
     import { TrianglePickingPredicate } from "babylonjs/Culling/ray";
     import { Animation } from "babylonjs/Animations/animation";
@@ -33604,7 +33658,7 @@ declare module "babylonjs/scene" {
          */
         markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, useOfflineSupport?: boolean, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
     }
@@ -56328,6 +56382,43 @@ declare module "babylonjs/Misc/deferred" {
         constructor();
     }
 }
+declare module "babylonjs/Misc/meshExploder" {
+    import { Mesh } from "babylonjs/Meshes/mesh";
+    /**
+     * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
+     */
+    export class MeshExploder {
+        private _centerMesh;
+        private _meshes;
+        private _meshesOrigins;
+        private _toCenterVectors;
+        private _scaledDirection;
+        private _newPosition;
+        private _centerPosition;
+        /**
+         * Explodes meshes from a center mesh.
+         * @param meshes The meshes to explode.
+         * @param centerMesh The mesh to be center of explosion.
+         */
+        constructor(meshes: Array<Mesh>, centerMesh?: Mesh);
+        private _setCenterMesh;
+        /**
+         * Get class name
+         * @returns "MeshExploder"
+         */
+        getClassName(): string;
+        /**
+         * "Exploded meshes"
+         * @returns Array of meshes with the centerMesh at index 0.
+         */
+        getMeshes(): Array<Mesh>;
+        /**
+         * Explodes meshes giving a specific direction
+         * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
+         */
+        explode(direction?: number): void;
+    }
+}
 declare module "babylonjs/Misc/filesInput" {
     import { Engine } from "babylonjs/Engines/engine";
     import { Scene } from "babylonjs/scene";
@@ -57016,6 +57107,7 @@ declare module "babylonjs/Misc/index" {
     export * from "babylonjs/Misc/decorators";
     export * from "babylonjs/Misc/deferred";
     export * from "babylonjs/Misc/environmentTextureTools";
+    export * from "babylonjs/Misc/meshExploder";
     export * from "babylonjs/Misc/filesInput";
     export * from "babylonjs/Misc/HighDynamicRange/index";
     export * from "babylonjs/Misc/khronosTextureContainer";
@@ -57041,6 +57133,7 @@ declare module "babylonjs/Misc/index" {
     export * from "babylonjs/Misc/precisionDate";
     export * from "babylonjs/Misc/screenshotTools";
     export * from "babylonjs/Misc/typeStore";
+    export * from "babylonjs/Misc/webRequest";
 }
 declare module "babylonjs/index" {
     export * from "babylonjs/abstractScene";
@@ -62700,7 +62793,8 @@ declare module BABYLON {
     /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest extends XMLHttpRequest {
+    export class WebRequest {
+        private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
          * i.e. when loading files, where the server/service expects an Authorization header
@@ -62711,8 +62805,58 @@ declare module BABYLON {
         /**
          * Add callback functions in this array to update all the requests before they get sent to the network
          */
-        static CustomRequestModifiers: ((request: WebRequest) => void)[];
+        static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[];
         private _injectCustomRequestHeaders;
+        /**
+         * Gets or sets a function to be called when loading progress changes
+         */
+        onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
+        /**
+         * Returns client's state
+         */
+        readonly readyState: number;
+        /**
+         * Returns client's status
+         */
+        readonly status: number;
+        /**
+         * Returns client's status as a text
+         */
+        readonly statusText: string;
+        /**
+         * Returns client's response
+         */
+        readonly response: any;
+        /**
+         * Returns client's response url
+         */
+        readonly responseURL: string;
+        /**
+         * Returns client's response as text
+         */
+        readonly responseText: string;
+        /**
+         * Gets or sets the expected response type
+         */
+        responseType: XMLHttpRequestResponseType;
+        /** @hidden */
+        addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+        /** @hidden */
+        removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+        /**
+         * Cancels any network activity
+         */
+        abort(): void;
+        /**
+         * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+         * @param body defines an optional request body
+         */
+        send(body?: Document | BodyInit | null): void;
+        /**
+         * Sets the request method, request URL
+         * @param method defines the method to use (GET, POST, etc..)
+         * @param url defines the url to connect with
+         */
         open(method: string, url: string): void;
     }
 }
@@ -85985,7 +86129,7 @@ declare module BABYLON {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
         private _partialLoadFile;
@@ -87795,17 +87939,17 @@ declare module BABYLON {
      * Application error to support additional information when loading a file
      */
     export class LoadFileError extends Error {
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined;
+        /** defines the optional web request */
+        request?: WebRequest | undefined;
         private static _setPrototypeOf;
         /**
          * Creates a new LoadFileError
          * @param message defines the message of the error
-         * @param request defines the optional XHR request
+         * @param request defines the optional web request
          */
         constructor(message: string, 
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined);
+        /** defines the optional web request */
+        request?: WebRequest | undefined);
     }
     /**
      * Class used to define a retry strategy when error happens while loading assets
@@ -87817,7 +87961,7 @@ declare module BABYLON {
          * @param baseInterval defines the interval between retries
          * @returns the strategy function to use
          */
-        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: WebRequest, retryIndex: number) => number;
     }
     /**
      * File request interface
@@ -87856,7 +88000,7 @@ declare module BABYLON {
         /**
          * Gets or sets the retry strategy to apply when an error happens while loading an asset
          */
-        static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;
         /**
          * Default behaviour for cors in the application.
          * It can be a string if the expected behavior is identical in the entire app.
@@ -88084,7 +88228,7 @@ declare module BABYLON {
          * @param onError callback called when the file fails to load
          * @returns a file request object
          */
-        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /**
          * 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)
@@ -90552,7 +90696,7 @@ declare module BABYLON {
          */
         markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, useOfflineSupport?: boolean, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
     }
@@ -111472,6 +111616,42 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
+     */
+    export class MeshExploder {
+        private _centerMesh;
+        private _meshes;
+        private _meshesOrigins;
+        private _toCenterVectors;
+        private _scaledDirection;
+        private _newPosition;
+        private _centerPosition;
+        /**
+         * Explodes meshes from a center mesh.
+         * @param meshes The meshes to explode.
+         * @param centerMesh The mesh to be center of explosion.
+         */
+        constructor(meshes: Array<Mesh>, centerMesh?: Mesh);
+        private _setCenterMesh;
+        /**
+         * Get class name
+         * @returns "MeshExploder"
+         */
+        getClassName(): string;
+        /**
+         * "Exploded meshes"
+         * @returns Array of meshes with the centerMesh at index 0.
+         */
+        getMeshes(): Array<Mesh>;
+        /**
+         * Explodes meshes giving a specific direction
+         * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
+         */
+        explode(direction?: number): void;
+    }
+}
+declare module BABYLON {
+    /**
      * Class used to help managing file picking and drag'n'drop
      */
     export class FilesInput {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.js.map


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.js.map


+ 204 - 24
dist/preview release/viewer/babylon.module.d.ts

@@ -4967,7 +4967,8 @@ declare module "babylonjs/Misc/webRequest" {
     /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest extends XMLHttpRequest {
+    export class WebRequest {
+        private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
          * i.e. when loading files, where the server/service expects an Authorization header
@@ -4978,8 +4979,58 @@ declare module "babylonjs/Misc/webRequest" {
         /**
          * Add callback functions in this array to update all the requests before they get sent to the network
          */
-        static CustomRequestModifiers: ((request: WebRequest) => void)[];
+        static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[];
         private _injectCustomRequestHeaders;
+        /**
+         * Gets or sets a function to be called when loading progress changes
+         */
+        onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
+        /**
+         * Returns client's state
+         */
+        readonly readyState: number;
+        /**
+         * Returns client's status
+         */
+        readonly status: number;
+        /**
+         * Returns client's status as a text
+         */
+        readonly statusText: string;
+        /**
+         * Returns client's response
+         */
+        readonly response: any;
+        /**
+         * Returns client's response url
+         */
+        readonly responseURL: string;
+        /**
+         * Returns client's response as text
+         */
+        readonly responseText: string;
+        /**
+         * Gets or sets the expected response type
+         */
+        responseType: XMLHttpRequestResponseType;
+        /** @hidden */
+        addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+        /** @hidden */
+        removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+        /**
+         * Cancels any network activity
+         */
+        abort(): void;
+        /**
+         * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+         * @param body defines an optional request body
+         */
+        send(body?: Document | BodyInit | null): void;
+        /**
+         * Sets the request method, request URL
+         * @param method defines the method to use (GET, POST, etc..)
+         * @param url defines the url to connect with
+         */
         open(method: string, url: string): void;
     }
 }
@@ -26826,6 +26877,7 @@ declare module "babylonjs/Engines/engine" {
     import { ILoadingScreen } from "babylonjs/Loading/loadingScreen";
     import { _DepthCullingState, _StencilState, _AlphaState } from "babylonjs/States/index";
     import { RenderTargetCreationOptions } from "babylonjs/Materials/Textures/renderTargetCreationOptions";
+    import { WebRequest } from "babylonjs/Misc/webRequest";
     import { PostProcess } from "babylonjs/PostProcesses/postProcess";
     import { RenderTargetTexture } from "babylonjs/Materials/Textures/renderTargetTexture";
     /**
@@ -28940,7 +28992,7 @@ declare module "babylonjs/Engines/engine" {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
         private _partialLoadFile;
@@ -30697,6 +30749,7 @@ declare module "babylonjs/Misc/tools" {
     import { IOfflineProvider } from "babylonjs/Offline/IOfflineProvider";
     import { Observable } from "babylonjs/Misc/observable";
     import { DomManagement } from "babylonjs/Misc/domManagement";
+    import { WebRequest } from "babylonjs/Misc/webRequest";
     import { Camera } from "babylonjs/Cameras/camera";
     import { Engine } from "babylonjs/Engines/engine";
     import { Animation } from "babylonjs/Animations/animation";
@@ -30793,17 +30846,17 @@ declare module "babylonjs/Misc/tools" {
      * Application error to support additional information when loading a file
      */
     export class LoadFileError extends Error {
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined;
+        /** defines the optional web request */
+        request?: WebRequest | undefined;
         private static _setPrototypeOf;
         /**
          * Creates a new LoadFileError
          * @param message defines the message of the error
-         * @param request defines the optional XHR request
+         * @param request defines the optional web request
          */
         constructor(message: string, 
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined);
+        /** defines the optional web request */
+        request?: WebRequest | undefined);
     }
     /**
      * Class used to define a retry strategy when error happens while loading assets
@@ -30815,7 +30868,7 @@ declare module "babylonjs/Misc/tools" {
          * @param baseInterval defines the interval between retries
          * @returns the strategy function to use
          */
-        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: WebRequest, retryIndex: number) => number;
     }
     /**
      * File request interface
@@ -30854,7 +30907,7 @@ declare module "babylonjs/Misc/tools" {
         /**
          * Gets or sets the retry strategy to apply when an error happens while loading an asset
          */
-        static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;
         /**
          * Default behaviour for cors in the application.
          * It can be a string if the expected behavior is identical in the entire app.
@@ -31082,7 +31135,7 @@ declare module "babylonjs/Misc/tools" {
          * @param onError callback called when the file fails to load
          * @returns a file request object
          */
-        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /**
          * 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)
@@ -31794,6 +31847,7 @@ declare module "babylonjs/scene" {
     import { Node } from "babylonjs/node";
     import { MorphTarget } from "babylonjs/Morph/morphTarget";
     import { AbstractActionManager } from "babylonjs/Actions/abstractActionManager";
+    import { WebRequest } from "babylonjs/Misc/webRequest";
     import { Ray } from "babylonjs/Culling/ray";
     import { TrianglePickingPredicate } from "babylonjs/Culling/ray";
     import { Animation } from "babylonjs/Animations/animation";
@@ -33604,7 +33658,7 @@ declare module "babylonjs/scene" {
          */
         markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, useOfflineSupport?: boolean, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
     }
@@ -56328,6 +56382,43 @@ declare module "babylonjs/Misc/deferred" {
         constructor();
     }
 }
+declare module "babylonjs/Misc/meshExploder" {
+    import { Mesh } from "babylonjs/Meshes/mesh";
+    /**
+     * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
+     */
+    export class MeshExploder {
+        private _centerMesh;
+        private _meshes;
+        private _meshesOrigins;
+        private _toCenterVectors;
+        private _scaledDirection;
+        private _newPosition;
+        private _centerPosition;
+        /**
+         * Explodes meshes from a center mesh.
+         * @param meshes The meshes to explode.
+         * @param centerMesh The mesh to be center of explosion.
+         */
+        constructor(meshes: Array<Mesh>, centerMesh?: Mesh);
+        private _setCenterMesh;
+        /**
+         * Get class name
+         * @returns "MeshExploder"
+         */
+        getClassName(): string;
+        /**
+         * "Exploded meshes"
+         * @returns Array of meshes with the centerMesh at index 0.
+         */
+        getMeshes(): Array<Mesh>;
+        /**
+         * Explodes meshes giving a specific direction
+         * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
+         */
+        explode(direction?: number): void;
+    }
+}
 declare module "babylonjs/Misc/filesInput" {
     import { Engine } from "babylonjs/Engines/engine";
     import { Scene } from "babylonjs/scene";
@@ -57016,6 +57107,7 @@ declare module "babylonjs/Misc/index" {
     export * from "babylonjs/Misc/decorators";
     export * from "babylonjs/Misc/deferred";
     export * from "babylonjs/Misc/environmentTextureTools";
+    export * from "babylonjs/Misc/meshExploder";
     export * from "babylonjs/Misc/filesInput";
     export * from "babylonjs/Misc/HighDynamicRange/index";
     export * from "babylonjs/Misc/khronosTextureContainer";
@@ -57041,6 +57133,7 @@ declare module "babylonjs/Misc/index" {
     export * from "babylonjs/Misc/precisionDate";
     export * from "babylonjs/Misc/screenshotTools";
     export * from "babylonjs/Misc/typeStore";
+    export * from "babylonjs/Misc/webRequest";
 }
 declare module "babylonjs/index" {
     export * from "babylonjs/abstractScene";
@@ -62700,7 +62793,8 @@ declare module BABYLON {
     /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest extends XMLHttpRequest {
+    export class WebRequest {
+        private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
          * i.e. when loading files, where the server/service expects an Authorization header
@@ -62711,8 +62805,58 @@ declare module BABYLON {
         /**
          * Add callback functions in this array to update all the requests before they get sent to the network
          */
-        static CustomRequestModifiers: ((request: WebRequest) => void)[];
+        static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[];
         private _injectCustomRequestHeaders;
+        /**
+         * Gets or sets a function to be called when loading progress changes
+         */
+        onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
+        /**
+         * Returns client's state
+         */
+        readonly readyState: number;
+        /**
+         * Returns client's status
+         */
+        readonly status: number;
+        /**
+         * Returns client's status as a text
+         */
+        readonly statusText: string;
+        /**
+         * Returns client's response
+         */
+        readonly response: any;
+        /**
+         * Returns client's response url
+         */
+        readonly responseURL: string;
+        /**
+         * Returns client's response as text
+         */
+        readonly responseText: string;
+        /**
+         * Gets or sets the expected response type
+         */
+        responseType: XMLHttpRequestResponseType;
+        /** @hidden */
+        addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+        /** @hidden */
+        removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+        /**
+         * Cancels any network activity
+         */
+        abort(): void;
+        /**
+         * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+         * @param body defines an optional request body
+         */
+        send(body?: Document | BodyInit | null): void;
+        /**
+         * Sets the request method, request URL
+         * @param method defines the method to use (GET, POST, etc..)
+         * @param url defines the url to connect with
+         */
         open(method: string, url: string): void;
     }
 }
@@ -85985,7 +86129,7 @@ declare module BABYLON {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
         private _partialLoadFile;
@@ -87795,17 +87939,17 @@ declare module BABYLON {
      * Application error to support additional information when loading a file
      */
     export class LoadFileError extends Error {
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined;
+        /** defines the optional web request */
+        request?: WebRequest | undefined;
         private static _setPrototypeOf;
         /**
          * Creates a new LoadFileError
          * @param message defines the message of the error
-         * @param request defines the optional XHR request
+         * @param request defines the optional web request
          */
         constructor(message: string, 
-        /** defines the optional XHR request */
-        request?: XMLHttpRequest | undefined);
+        /** defines the optional web request */
+        request?: WebRequest | undefined);
     }
     /**
      * Class used to define a retry strategy when error happens while loading assets
@@ -87817,7 +87961,7 @@ declare module BABYLON {
          * @param baseInterval defines the interval between retries
          * @returns the strategy function to use
          */
-        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: WebRequest, retryIndex: number) => number;
     }
     /**
      * File request interface
@@ -87856,7 +88000,7 @@ declare module BABYLON {
         /**
          * Gets or sets the retry strategy to apply when an error happens while loading an asset
          */
-        static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
+        static DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;
         /**
          * Default behaviour for cors in the application.
          * It can be a string if the expected behavior is identical in the entire app.
@@ -88084,7 +88228,7 @@ declare module BABYLON {
          * @param onError callback called when the file fails to load
          * @returns a file request object
          */
-        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /**
          * 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)
@@ -90552,7 +90696,7 @@ declare module BABYLON {
          */
         markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
         /** @hidden */
         _loadFileAsync(url: string, useOfflineSupport?: boolean, useArrayBuffer?: boolean): Promise<string | ArrayBuffer>;
     }
@@ -111472,6 +111616,42 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
+     */
+    export class MeshExploder {
+        private _centerMesh;
+        private _meshes;
+        private _meshesOrigins;
+        private _toCenterVectors;
+        private _scaledDirection;
+        private _newPosition;
+        private _centerPosition;
+        /**
+         * Explodes meshes from a center mesh.
+         * @param meshes The meshes to explode.
+         * @param centerMesh The mesh to be center of explosion.
+         */
+        constructor(meshes: Array<Mesh>, centerMesh?: Mesh);
+        private _setCenterMesh;
+        /**
+         * Get class name
+         * @returns "MeshExploder"
+         */
+        getClassName(): string;
+        /**
+         * "Exploded meshes"
+         * @returns Array of meshes with the centerMesh at index 0.
+         */
+        getMeshes(): Array<Mesh>;
+        /**
+         * Explodes meshes giving a specific direction
+         * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
+         */
+        explode(direction?: number): void;
+    }
+}
+declare module BABYLON {
+    /**
      * Class used to help managing file picking and drag'n'drop
      */
     export class FilesInput {

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

@@ -196,11 +196,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<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -217,11 +217,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -950,7 +950,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): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1593,6 +1593,20 @@ 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 {
     export interface IEnvironmentMapConfiguration {
             /**
                 * Environment map texture path in relative to the asset folder.

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 23 - 19
dist/preview release/viewer/babylon.viewer.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


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

@@ -229,11 +229,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<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -250,11 +250,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -1030,13 +1030,14 @@ 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): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1736,6 +1737,22 @@ 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';

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

@@ -51,7 +51,7 @@
 
 ### Core Engine
 
-- Added new `WebRequest` class to centralize all network requests ([Deltakosh](https://github.com/deltakosh))
+- Added new `WebRequest` class to centralize all network requests. Can be used to configure headers of all network requests ([Deltakosh](https://github.com/deltakosh))
 - Added support for user clip planes to LineMeshes ([Deltakosh](https://github.com/deltakosh))
 - Optimized effect reused for shadow maps ([Deltakosh](https://github.com/deltakosh))
 - Added `shadowGenerator.onBeforeShadowMapRenderMeshObservable` ([Deltakosh](https://github.com/deltakosh))
@@ -225,6 +225,7 @@
 
 ## Breaking changes
 
+- All references to XmlHttpRequest were replace by `WebRequest` (which provides the same signatures) ([Deltakosh](https://github.com/deltakosh))
 - `Database.IDBStorageEnabled` is now false by default ([Deltakosh](https://github.com/deltakosh))
 - `Database.openAsync` was renamed by `Database.open` ([Deltakosh](https://github.com/deltakosh))
 - `scene.database` was renamed to `scene.offlineProvider` ([Deltakosh](https://github.com/deltakosh))

+ 2 - 1
loaders/src/OBJ/objFileLoader.ts

@@ -14,6 +14,7 @@ import { SceneLoader, ISceneLoaderPluginAsync, SceneLoaderProgressEvent, ISceneL
 
 import { AssetContainer } from "babylonjs/assetContainer";
 import { Scene } from "babylonjs/scene";
+import { WebRequest } from 'babylonjs/Misc/webRequest';
 /**
  * Class reading and parsing the MTL file bundled with the obj file.
  */
@@ -375,7 +376,7 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
             undefined,
             undefined,
             false,
-            (request?: XMLHttpRequest | undefined, exception?: any) => {
+            (request?: WebRequest | undefined, exception?: any) => {
                 onFailure(pathOfFile, exception);
             }
         );

+ 7 - 6
src/Engines/engine.ts

@@ -29,6 +29,7 @@ import { Logger } from "../Misc/logger";
 import { EngineStore } from "./engineStore";
 import { RenderTargetCreationOptions } from "../Materials/Textures/renderTargetCreationOptions";
 import { _DevTools } from '../Misc/devTools';
+import { WebRequest } from '../Misc/webRequest';
 
 declare type PostProcess = import("../PostProcesses/postProcess").PostProcess;
 declare type Texture = import("../Materials/Textures/texture").Texture;
@@ -2157,7 +2158,7 @@ export class Engine {
             // TODO: We should only submit the frame if we read frameData successfully.
             try {
                 this._vrDisplay.submitFrame();
-            }catch (e) {
+            } catch (e) {
                 Tools.Warn("webVR submitFrame has had an unexpected failure: " + e);
             }
         }
@@ -4411,7 +4412,7 @@ export class Engine {
             };
 
             if (!buffer) {
-                this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, (request?: XMLHttpRequest, exception?: any) => {
+                this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, (request?: WebRequest, exception?: any) => {
                     onInternalError("Unable to load " + (request ? request.responseURL : url, exception));
                 });
             } else {
@@ -5671,7 +5672,7 @@ export class Engine {
             }
         }
 
-        let onInternalError = (request?: XMLHttpRequest, exception?: any) => {
+        let onInternalError = (request?: WebRequest, exception?: any) => {
             if (loader) {
                 const fallbackUrl = loader.getFallbackTextureUrl(texture.url, this._textureFormatInUse);
                 Logger.Warn((loader.constructor as any).name + " failed when trying to load " + texture.url + ", falling back to the next supported loader");
@@ -5960,7 +5961,7 @@ export class Engine {
         texture.url = url;
         this._internalTexturesCache.push(texture);
 
-        var onerror = (request?: XMLHttpRequest, exception?: any) => {
+        var onerror = (request?: WebRequest, exception?: any) => {
             scene._removePendingData(texture);
             if (onError && request) {
                 onError(request.status + " " + request.statusText, exception);
@@ -7468,7 +7469,7 @@ export class Engine {
     }
 
     /** @hidden */
-    public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest {
+    public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest {
         let request = Tools.LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);
         this._activeRequests.push(request);
         request.onCompleteObservable.add((request) => {
@@ -7498,7 +7499,7 @@ export class Engine {
             }
         };
 
-        const onerror = (request?: XMLHttpRequest, exception?: any) => {
+        const onerror = (request?: WebRequest, exception?: any) => {
             if (onErrorCallBack && request) {
                 onErrorCallBack(request.status + " " + request.statusText, exception);
             }

+ 2 - 2
src/Materials/Textures/Procedurals/customProceduralTexture.ts

@@ -50,9 +50,9 @@ export class CustomProceduralTexture extends ProceduralTexture {
         };
 
         var configFileUrl = jsonUrl + "/config.json";
-        var xhr: XMLHttpRequest = new WebRequest();
+        var xhr = new WebRequest();
 
-        xhr.open("GET", configFileUrl, true);
+        xhr.open("GET", configFileUrl);
         xhr.addEventListener("load", () => {
             if (xhr.status === 200 || (xhr.responseText && xhr.responseText.length > 0)) {
                 try {

+ 1 - 0
src/Misc/index.ts

@@ -30,3 +30,4 @@ export * from "./pivotTools";
 export * from "./precisionDate";
 export * from "./screenshotTools";
 export * from "./typeStore";
+export * from "./webRequest";

+ 19 - 19
src/Misc/meshExploder.ts

@@ -2,16 +2,16 @@ import { Mesh } from "../Meshes/mesh";
 import { Vector3 } from "../Maths/math";
 
 /**
- * Class used to explode meshes.
+ * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)
  */
 export class MeshExploder {
     private _centerMesh: Mesh;
     private _meshes: Array<Mesh>;
     private _meshesOrigins: Array<Vector3> = [];
     private _toCenterVectors: Array<Vector3> = [];
-    private _scaledDirection = new Vector3(0.0, 0.0, 0.0);
-    private _newPosition = new Vector3(0.0, 0.0, 0.0);
-    private _centerPosition = new Vector3(0.0, 0.0, 0.0);
+    private _scaledDirection = Vector3.Zero();
+    private _newPosition = Vector3.Zero();
+    private _centerPosition = Vector3.Zero();
 
     /**
      * Explodes meshes from a center mesh.
@@ -27,15 +27,16 @@ export class MeshExploder {
         } else {
             this._setCenterMesh();
         }
-        if (this._meshes.indexOf(this._centerMesh) >= 0) {
-            this._meshes.splice(this._meshes.indexOf(this._centerMesh), 1);
+        const centerMeshIndex = this._meshes.indexOf(this._centerMesh);
+        if (centerMeshIndex >= 0) {
+            this._meshes.splice(centerMeshIndex, 1);
         }
         this._centerPosition = this._centerMesh.getAbsolutePosition().clone();
         for (var index = 0; index < this._meshes.length; index++) {
             if (this._meshes[index]) {
                 var mesh = this._meshes[index];
                 this._meshesOrigins[index] = mesh.getAbsolutePosition().clone();
-                this._toCenterVectors[index] = new Vector3(0.0, 0.0, 0.0);
+                this._toCenterVectors[index] = Vector3.Zero();
                 if (mesh._boundingInfo && this._centerMesh._boundingInfo) {
                     mesh._boundingInfo.boundingBox.centerWorld.subtractToRef(this._centerMesh._boundingInfo.boundingBox.centerWorld, this._toCenterVectors[index]);
                 }
@@ -44,14 +45,15 @@ export class MeshExploder {
     }
 
     private _setCenterMesh(): void {
-        var averageCenter = new Vector3(0.0, 0.0, 0.0);
-        var totalCenters = new Vector3(0.0, 0.0, 0.0);
+        var averageCenter = Vector3.Zero();
+        var totalCenters = Vector3.Zero();
         var shortestToCenter = Number.MAX_VALUE;
         for (var index = 0; index < this._meshes.length; index++) {
             if (this._meshes[index]) {
                 var mesh = this._meshes[index];
-                if (mesh._boundingInfo) {
-                    totalCenters.addInPlace(mesh._boundingInfo.boundingBox.centerWorld);
+                const boundingInfo = mesh.getBoundingInfo();
+                if (boundingInfo) {
+                    totalCenters.addInPlace(boundingInfo.boundingBox.centerWorld);
                 }
             }
         }
@@ -59,8 +61,9 @@ export class MeshExploder {
         for (var index = 0; index < this._meshes.length; index++) {
             if (this._meshes[index]) {
                 var mesh = this._meshes[index];
-                if (mesh._boundingInfo) {
-                    var distanceToCenter = mesh._boundingInfo.boundingBox.centerWorld.subtract(averageCenter).length();
+                const boundingInfo = mesh.getBoundingInfo();
+                if (boundingInfo) {
+                    var distanceToCenter = boundingInfo.boundingBox.centerWorld.subtract(averageCenter).lengthSquared();
                     if (distanceToCenter < shortestToCenter) {
                         this._centerMesh = mesh;
                         shortestToCenter = distanceToCenter;
@@ -71,7 +74,7 @@ export class MeshExploder {
     }
 
     /**
-     * "MeshExploder"
+     * Get class name
      * @returns "MeshExploder"
      */
     public getClassName(): string {
@@ -83,14 +86,13 @@ export class MeshExploder {
      * @returns Array of meshes with the centerMesh at index 0.
      */
     public getMeshes(): Array<Mesh> {
-        var meshArray: Array<Mesh>;
-        meshArray = this._meshes.slice();
+        var meshArray = this._meshes.slice();
         meshArray.unshift(this._centerMesh);
         return meshArray;
     }
 
     /**
-     * Explodes mesh a given number of times.
+     * Explodes meshes giving a specific direction
      * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.
      */
     public explode(direction: number = 1.0): void {
@@ -99,10 +101,8 @@ export class MeshExploder {
                 this._toCenterVectors[index].scaleToRef(direction, this._scaledDirection);
                 this._meshesOrigins[index].addToRef(this._scaledDirection, this._newPosition);
                 this._meshes[index].setAbsolutePosition(this._newPosition);
-                this._meshes[index].computeWorldMatrix(true);
             }
         }
         this._centerMesh.setAbsolutePosition(this._centerPosition);
-        this._centerMesh.computeWorldMatrix(true);
     }
 }

+ 5 - 5
src/Misc/tools.ts

@@ -141,12 +141,12 @@ export class LoadFileError extends Error {
     /**
      * Creates a new LoadFileError
      * @param message defines the message of the error
-     * @param request defines the optional XHR request
+     * @param request defines the optional web request
      */
     constructor(
         message: string,
-        /** defines the optional XHR request */
-        public request?: XMLHttpRequest
+        /** defines the optional web request */
+        public request?: WebRequest
     ) {
         super(message);
         this.name = "LoadFileError";
@@ -166,7 +166,7 @@ export class RetryStrategy {
      * @returns the strategy function to use
      */
     public static ExponentialBackoff(maxRetries = 3, baseInterval = 500) {
-        return (url: string, request: XMLHttpRequest, retryIndex: number): number => {
+        return (url: string, request: WebRequest, retryIndex: number): number => {
             if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf("file:") !== -1) {
                 return -1;
             }
@@ -844,7 +844,7 @@ export class Tools {
      * @param onError callback called when the file fails to load
      * @returns a file request object
      */
-    public static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest {
+    public static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest {
         url = Tools.CleanUrl(url);
 
         url = Tools.PreprocessUrl(url);

+ 102 - 7
src/Misc/webRequest.ts

@@ -1,7 +1,8 @@
 /**
  * Extended version of XMLHttpRequest with support for customizations (headers, ...)
  */
-export class WebRequest extends XMLHttpRequest {
+export class WebRequest {
+    private _xhr = new XMLHttpRequest();
 
     /**
      * Custom HTTP Request Headers to be sent with XMLHttpRequests
@@ -12,28 +13,122 @@ export class WebRequest extends XMLHttpRequest {
     /**
      * Add callback functions in this array to update all the requests before they get sent to the network
      */
-    public static CustomRequestModifiers = new Array<(request: WebRequest) => void>();
+    public static CustomRequestModifiers = new Array<(request: XMLHttpRequest) => void>();
 
     private _injectCustomRequestHeaders(): void {
         for (let key in WebRequest.CustomRequestHeaders) {
             const val = WebRequest.CustomRequestHeaders[key];
             if (val) {
-                this.setRequestHeader(key, val);
+                this._xhr.setRequestHeader(key, val);
             }
         }
     }
 
-    open(method: string, url: string): void;
-    open(method: string, url: string, async: boolean = true, username?: string | null, password?: string | null): void {
+    /**
+     * Gets or sets a function to be called when loading progress changes
+     */
+    public get onprogress(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null {
+        return this._xhr.onprogress;
+    }
+
+    public set onprogress(value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null) {
+        this._xhr.onprogress = value;
+    }
+
+    /**
+     * Returns client's state
+     */
+    public get readyState(): number {
+        return this._xhr.readyState;
+    }
+
+    /**
+     * Returns client's status
+     */
+    public get status(): number {
+        return this._xhr.status;
+    }
+
+    /**
+     * Returns client's status as a text
+     */
+    public get statusText(): string {
+        return this._xhr.statusText;
+    }
+
+    /**
+     * Returns client's response
+     */
+    public get response(): any {
+        return this._xhr.response;
+    }
+
+    /**
+     * Returns client's response url
+     */
+    public get responseURL(): string {
+        return this._xhr.responseURL;
+    }
 
+    /**
+     * Returns client's response as text
+     */
+    public get responseText(): string {
+        return this._xhr.responseText;
+    }
+
+    /**
+     * Gets or sets the expected response type
+     */
+    public get responseType(): XMLHttpRequestResponseType {
+        return this._xhr.responseType;
+    }
+
+    public set responseType(value: XMLHttpRequestResponseType) {
+        this._xhr.responseType = value;
+    }
+
+    /** @hidden */
+    public addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+    public addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void {
+        this._xhr.addEventListener(type, listener, options);
+    }
+
+    /** @hidden */
+    public removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+    public removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void {
+        this._xhr.removeEventListener(type, listener, options);
+    }
+
+    /**
+     * Cancels any network activity
+     */
+    public abort() {
+        this._xhr.abort();
+    }
+
+    /**
+     * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD
+     * @param body defines an optional request body
+     */
+    public send(body?: Document | BodyInit | null): void {
+        this._xhr.send(body);
+    }
+
+    /**
+     * Sets the request method, request URL
+     * @param method defines the method to use (GET, POST, etc..)
+     * @param url defines the url to connect with
+     */
+    public open(method: string, url: string): void {
         if (WebRequest.CustomRequestHeaders) {
             this._injectCustomRequestHeaders();
         }
 
         for (var update of WebRequest.CustomRequestModifiers) {
-            update(this);
+            update(this._xhr);
         }
 
-        return super.open(method, url, async, username, password);
+        return this._xhr.open(method, url, true);
     }
 }

+ 4 - 4
src/Offline/database.ts

@@ -110,14 +110,14 @@ export class Database implements IOfflineProvider {
         var timeStampUsed = false;
         var manifestURL = this._currentSceneUrl + ".manifest";
 
-        var xhr: XMLHttpRequest = new WebRequest();
+        var xhr = new WebRequest();
 
         if (navigator.onLine) {
             // Adding a timestamp to by-pass browsers' cache
             timeStampUsed = true;
             manifestURL = manifestURL + (manifestURL.match(/\?/) == null ? "?" : "&") + Date.now();
         }
-        xhr.open("GET", manifestURL, true);
+        xhr.open("GET", manifestURL);
 
         xhr.addEventListener("load", () => {
             if (xhr.status === 200 || Database._ValidateXHRData(xhr, 1)) {
@@ -147,7 +147,7 @@ export class Database implements IOfflineProvider {
                 // Let's retry without the timeStamp
                 // It could fail when coupled with HTML5 Offline API
                 var retryManifestURL = this._currentSceneUrl + ".manifest";
-                xhr.open("GET", retryManifestURL, true);
+                xhr.open("GET", retryManifestURL);
                 xhr.send();
             }
             else {
@@ -671,7 +671,7 @@ export class Database implements IOfflineProvider {
      * @param dataType defines the expected data type
      * @returns true if data is correct
      */
-    private static _ValidateXHRData(xhr: XMLHttpRequest, dataType = 7): boolean {
+    private static _ValidateXHRData(xhr: WebRequest, dataType = 7): boolean {
         // 1 for text (.babylon, manifest and shaders), 2 for TGA, 4 for DDS, 7 for all
 
         try {

+ 3 - 2
src/scene.ts

@@ -45,6 +45,7 @@ import { Logger } from "./Misc/logger";
 import { EngineStore } from "./Engines/engineStore";
 import { AbstractActionManager } from './Actions/abstractActionManager';
 import { _DevTools } from './Misc/devTools';
+import { WebRequest } from './Misc/webRequest';
 
 declare type Ray = import("./Culling/ray").Ray;
 declare type TrianglePickingPredicate = import("./Culling/ray").TrianglePickingPredicate;
@@ -4757,7 +4758,7 @@ export class Scene extends AbstractScene implements IAnimatable {
     public pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean,
         fastCheck?: boolean, camera?: Nullable<Camera>,
         trianglePredicate?: (p0: Vector3, p1: Vector3, p2: Vector3) => boolean
-        ): Nullable<PickingInfo> {
+    ): Nullable<PickingInfo> {
         // Dummy info if picking as not been imported
         const pi = new PickingInfo();
         pi._pickingUnavailable = true;
@@ -5012,7 +5013,7 @@ export class Scene extends AbstractScene implements IAnimatable {
     }
 
     /** @hidden */
-    public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest {
+    public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useOfflineSupport?: boolean, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest {
         let request = Tools.LoadFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError);
         this._activeRequests.push(request);
         request.onCompleteObservable.add((request) => {