David Catuhe 7 gadi atpakaļ
vecāks
revīzija
5c23a36117

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 21684 - 21089
Playground/babylon.d.txt


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 21758 - 21163
dist/preview release/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/babylon.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 606 - 156
dist/preview release/babylon.max.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 606 - 156
dist/preview release/babylon.no-module.max.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/babylon.worker.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 608 - 158
dist/preview release/es6.js


+ 4 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.js

@@ -2043,7 +2043,10 @@ var BABYLON;
                     var attribute = technique.attributes[attr];
                     var attributeParameter = technique.parameters[attribute];
                     if (attributeParameter.semantic) {
-                        attributes.push(getAttribute(attributeParameter));
+                        var name_1 = getAttribute(attributeParameter);
+                        if (name_1) {
+                            attributes.push(name_1);
+                        }
                     }
                 }
                 // Configure vertex shader

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


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

@@ -2043,7 +2043,10 @@ var BABYLON;
                     var attribute = technique.attributes[attr];
                     var attributeParameter = technique.parameters[attribute];
                     if (attributeParameter.semantic) {
-                        attributes.push(getAttribute(attributeParameter));
+                        var name_1 = getAttribute(attributeParameter);
+                        if (name_1) {
+                            attributes.push(name_1);
+                        }
                     }
                 }
                 // Configure vertex shader

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


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

@@ -3126,7 +3126,10 @@ var BABYLON;
                     var attribute = technique.attributes[attr];
                     var attributeParameter = technique.parameters[attribute];
                     if (attributeParameter.semantic) {
-                        attributes.push(getAttribute(attributeParameter));
+                        var name_1 = getAttribute(attributeParameter);
+                        if (name_1) {
+                            attributes.push(name_1);
+                        }
                     }
                 }
                 // Configure vertex shader

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 148 - 1048
dist/preview release/typedocValidationBaseline.json


+ 139 - 384
dist/preview release/viewer/babylon.viewer.d.ts

@@ -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<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)
                 *
@@ -189,252 +189,16 @@ 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;
     }
 }
 declare module BabylonViewer {
-    /**
-        * The AbstractViewr is the center of Babylon's 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;
-            /**
-                * The corresponsing template manager of this viewer.
-                */
-            templateManager: TemplateManager;
-            /**
-                * Babylon BABYLON.Engine corresponding with this viewer
-                */
-            engine: BABYLON.Engine;
-            /**
-                * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
-                */
-            readonly baseId: string;
-            /**
-                * The last loader used to load a model.
-                * @deprecated
-                */
-            lastUsedLoader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
-            /**
-                * The ModelLoader instance connected with this viewer.
-                */
-            modelLoader: ModelLoader;
-            /**
-                * A flag that controls whether or not the render loop should be executed
-                */
-            runRenderLoop: boolean;
-            /**
-                * The scene manager connected with this viewer instance
-                */
-            sceneManager: SceneManager;
-            /**
-                * Will notify when the scene was initialized
-                */
-            readonly onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
-            /**
-                * will notify when the engine was initialized
-                */
-            readonly onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
-            /**
-                * Will notify when a new model was added to the scene.
-                * Note that added does not neccessarily mean loaded!
-                */
-            readonly onModelAddedObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * will notify after every model load
-                */
-            readonly onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * will notify when any model notify of progress
-                */
-            readonly onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
-            /**
-                * will notify when any model load failed.
-                */
-            readonly onModelLoadErrorObservable: BABYLON.Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will notify when a model was removed from the scene;
-                */
-            readonly onModelRemovedObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * will notify when a new loader was initialized.
-                * Used mainly to know when a model starts loading.
-                */
-            readonly onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
-            /**
-                * Observers registered here will be executed when the entire load process has finished.
-                */
-            readonly onInitDoneObservable: BABYLON.Observable<AbstractViewer>;
-            /**
-                * Functions added to this observable will be executed on each frame rendered.
-                */
-            readonly onFrameRenderedObservable: BABYLON.Observable<AbstractViewer>;
-            /**
-                * Observers registered here will be executed when VR more is entered.
-                */
-            readonly onEnteringVRObservable: BABYLON.Observable<AbstractViewer>;
-            /**
-                * Observers registered here will be executed when VR mode is exited.
-                */
-            readonly onExitingVRObservable: BABYLON.Observable<AbstractViewer>;
-            observablesManager: ObservablesManager;
-            /**
-                * The canvas associated with this viewer
-                */
-            protected _canvas: HTMLCanvasElement;
-            /**
-                * The (single) canvas of this viewer
-                */
-            readonly canvas: HTMLCanvasElement;
-            /**
-                * is this viewer disposed?
-                */
-            protected _isDisposed: boolean;
-            /**
-                * registered onBeforeRender functions.
-                * This functions are also registered at the native scene. The reference can be used to unregister them.
-                */
-            protected _registeredOnBeforeRenderFunctions: Array<() => void>;
-            /**
-                * The configuration loader of this viewer
-                */
-            protected _configurationLoader: ConfigurationLoader;
-            /**
-                * Is the viewer already initialized. for internal use.
-                */
-            protected _isInit: boolean;
-            protected _configurationContainer: ConfigurationContainer;
-            readonly configurationContainer: ConfigurationContainer;
-            constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
-            /**
-                * get the baseId of this viewer
-                */
-            getBaseId(): string;
-            /**
-                * Do we have a canvas to render on, and is it a part of the scene
-                */
-            isCanvasInDOM(): boolean;
-            /**
-             * Set the viewer's background rendering flag.
-             */
-            renderInBackground: boolean;
-            /**
-                * Get the configuration object. This is a reference only.
-                * The configuration can ONLY be updated using the updateConfiguration function.
-                * changing this object will have no direct effect on the scene.
-                */
-            readonly configuration: ViewerConfiguration;
-            /**
-                * force resizing the engine.
-                */
-            forceResize(): void;
-            protected _hdToggled: boolean;
-            toggleHD(): void;
-            protected _vrToggled: boolean;
-            protected _vrScale: number;
-            protected _vrInit: boolean;
-            toggleVR(): void;
-            protected _initVR(): void;
-            /**
-                * The resize function that will be registered with the window object
-                */
-            protected _resize: () => void;
-            protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
-            /**
-                * Force a single render loop execution.
-                */
-            forceRender(): void;
-            /**
-                * render loop that will be executed by the engine
-                */
-            protected _render: (force?: boolean) => void;
-            /**
-                * Takes a screenshot of the scene and returns it as a base64 encoded png.
-                * @param callback optional callback that will be triggered when screenshot is done.
-                * @param width Optional screenshot width (default to 512).
-                * @param height Optional screenshot height (default to 512).
-                * @returns a promise with the screenshot data
-                */
-            takeScreenshot(callback?: (data: string) => void, width?: number, height?: number): Promise<string>;
-            /**
-                * Update the current viewer configuration with new values.
-                * Only provided information will be updated, old configuration values will be kept.
-                * If this.configuration was manually changed, you can trigger this function with no parameters,
-                * and the entire configuration will be updated.
-                * @param newConfiguration the partial configuration to update or a URL to a JSON holding the updated configuration
-                *
-                */
-            updateConfiguration(newConfiguration?: Partial<ViewerConfiguration> | string): void;
-            /**
-                * this is used to register native functions using the configuration object.
-                * This will configure the observers.
-                * @param observersConfiguration observers configuration
-                */
-            protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
-            /**
-                * Dispose the entire viewer including the scene and the engine
-                */
-            dispose(): void;
-            /**
-                * This will prepare the container element for the viewer
-                */
-            protected abstract _prepareContainerElement(): any;
-            /**
-                * This function will execute when the HTML templates finished initializing.
-                * It should initialize the engine and continue execution.
-                *
-                * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
-                */
-            protected _onTemplatesLoaded(): Promise<AbstractViewer>;
-            /**
-                * This will force the creation of an engine and a scene.
-                * It will also load a model if preconfigured.
-                * But first - it will load the extendible onTemplateLoaded()!
-                */
-            protected _onTemplateLoaded(): Promise<AbstractViewer>;
-            /**
-                * Initialize the engine. Retruns a promise in case async calls are needed.
-                *
-                * @protected
-                * @returns {Promise<BABYLON.Engine>}
-                * @memberof Viewer
-                */
-            protected _initEngine(): Promise<BABYLON.Engine>;
-            /**
-                * Initialize a model loading. The returned object (a ViewerModel object) will be loaded in the background.
-                * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
-                *
-                * @param modelConfig model configuration to use when loading the model.
-                * @param clearScene should the scene be cleared before loading this model
-                * @returns a ViewerModel object that is not yet fully loaded.
-                */
-            initModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): ViewerModel;
-            /**
-                * load a model using the provided configuration.
-                * This function, as opposed to initModel, will return a promise that resolves when the model is loaded, and rejects with error.
-                * If you want to attach to the observables of the model, use initModle instead.
-                *
-                * @param modelConfig the model configuration or URL to load.
-                * @param clearScene Should the scene be cleared before loading the model
-                * @returns a Promise the fulfills when the model finished loading successfully.
-                */
-            loadModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): Promise<ViewerModel>;
-            protected _initTelemetryEvents(): void;
-            /**
-                * Injects all the spectre shader in the babylon shader store
-                */
-            protected _injectCustomShaders(): void;
-    }
 }
 declare module BabylonViewer {
     /**
@@ -924,7 +688,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 {
@@ -1212,26 +976,69 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * The configuration loader will load the configuration object from any source and will use the defined mapper to
-        * parse the object and return a conform ViewerConfiguration.
-        * It is a private member of the scene.
-        */
-    export class ConfigurationLoader {
-            constructor(_enableCache?: boolean);
+    export interface IModelConfiguration {
+            id?: string;
+            url?: string;
+            root?: string;
+            file?: string | File;
+            loader?: string;
+            position?: {
+                    x: number;
+                    y: number;
+                    z: number;
+            };
+            rotation?: {
+                    x: number;
+                    y: number;
+                    z: number;
+                    w?: number;
+            };
+            scaling?: {
+                    x: number;
+                    y: number;
+                    z: number;
+            };
+            parentObjectIndex?: number;
+            castShadow?: boolean;
+            receiveShadows?: boolean;
+            normalize?: boolean | {
+                    center?: boolean;
+                    unitSize?: boolean;
+                    parentIndex?: number;
+            };
+            title?: string;
+            subtitle?: string;
+            thumbnail?: string;
+            animation?: {
+                    autoStart?: boolean | string;
+                    playOnce?: boolean;
+                    autoStartIndex?: number;
+            };
+            entryAnimation?: IModelAnimationConfiguration;
+            exitAnimation?: IModelAnimationConfiguration;
+            material?: {
+                    directEnabled?: boolean;
+                    directIntensity?: number;
+                    emissiveIntensity?: number;
+                    environmentIntensity?: number;
+                    [propName: string]: any;
+            };
             /**
-                * load a configuration object that is defined in the initial configuration provided.
-                * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
-                *
-                * @param initConfig the initial configuration that has the definitions of further configuration to load.
-                * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
-                * @returns A promise that delivers the extended viewer configuration, when done.
+                * Rotation offset axis definition
                 */
-            loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
+            rotationOffsetAxis?: {
+                    x: number;
+                    y: number;
+                    z: number;
+            };
             /**
-                * Dispose the configuration loader. This will cancel file requests, if active.
+                * the offset angle
                 */
-            dispose(): void;
+            rotationOffsetAngle?: number;
+            loaderConfiguration?: {
+                    maxLODsToLoad?: number;
+                    progressiveLoading?: boolean;
+            };
     }
 }
 declare module BabylonViewer {
@@ -1299,6 +1106,33 @@ declare module BabylonViewer {
 }
 declare module BabylonViewer {
     /**
+        * Get a loader plugin according to its name.
+        * The plugin will be cached and will be reused if called for again.
+        *
+        * @param name the name of the plugin
+        */
+    export function getLoaderPluginByName(name: string): ILoaderPlugin;
+    /**
+        *
+        */
+    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 {
+    /**
         * This interface describes the structure of the variable sent with the configuration observables of the scene manager.
         * O - the type of object we are dealing with (Light, BABYLON.ArcRotateCamera, BABYLON.Scene, etc')
         * T - the configuration type
@@ -1479,85 +1313,6 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    export interface IModelConfiguration {
-            id?: string;
-            url?: string;
-            root?: string;
-            file?: string | File;
-            loader?: string;
-            position?: {
-                    x: number;
-                    y: number;
-                    z: number;
-            };
-            rotation?: {
-                    x: number;
-                    y: number;
-                    z: number;
-                    w?: number;
-            };
-            scaling?: {
-                    x: number;
-                    y: number;
-                    z: number;
-            };
-            parentObjectIndex?: number;
-            castShadow?: boolean;
-            receiveShadows?: boolean;
-            normalize?: boolean | {
-                    center?: boolean;
-                    unitSize?: boolean;
-                    parentIndex?: number;
-            };
-            title?: string;
-            subtitle?: string;
-            thumbnail?: string;
-            animation?: {
-                    autoStart?: boolean | string;
-                    playOnce?: boolean;
-                    autoStartIndex?: number;
-            };
-            entryAnimation?: IModelAnimationConfiguration;
-            exitAnimation?: IModelAnimationConfiguration;
-            material?: {
-                    directEnabled?: boolean;
-                    directIntensity?: number;
-                    emissiveIntensity?: number;
-                    environmentIntensity?: number;
-                    [propName: string]: any;
-            };
-            /**
-                * Rotation offset axis definition
-                */
-            rotationOffsetAxis?: {
-                    x: number;
-                    y: number;
-                    z: number;
-            };
-            /**
-                * the offset angle
-                */
-            rotationOffsetAngle?: number;
-            loaderConfiguration?: {
-                    maxLODsToLoad?: number;
-                    progressiveLoading?: boolean;
-            };
-    }
-}
-declare module BabylonViewer {
-    /**
-        * Get a loader plugin according to its name.
-        * The plugin will be cached and will be reused if called for again.
-        *
-        * @param name the name of the plugin
-        */
-    export function getLoaderPluginByName(name: string): ILoaderPlugin;
-    /**
-        *
-        */
-    export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
-}
-declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {
@@ -1618,54 +1373,6 @@ declare module BabylonViewer {
 }
 declare module BabylonViewer {
     /**
-        * The ViewerLabs class will hold functions that are not (!) backwards compatible.
-        * The APIs in all labs-related classes and configuration  might change.
-        * Once stable, lab features will be moved to the publis API and configuration object.
-        */
-    export class ViewerLabs {
-            constructor(_scene: BABYLON.Scene);
-            assetsRootURL: string;
-            environment: PBREnvironment;
-            /**
-                        * Loads an environment map from a given URL
-                        * @param url URL of environment map
-                        * @param onSuccess Callback fired after environment successfully applied to the scene
-                        * @param onProgress Callback fired at progress events while loading the environment map
-                        * @param onError Callback fired when the load fails
-                        */
-            loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
-            /**
-                * Loads an environment map from a given URL
-                * @param buffer ArrayBuffer containing environment map
-                * @param onSuccess Callback fired after environment successfully applied to the scene
-                * @param onProgress Callback fired at progress events while loading the environment map
-                * @param onError Callback fired when the load fails
-                */
-            loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
-            /**
-                * Sets the environment to an already loaded environment
-                * @param env PBREnvironment instance
-                * @param onSuccess Callback fired after environment successfully applied to the scene
-                * @param onProgress Callback fired at progress events while loading the environment map
-                * @param onError Callback fired when the load fails
-                */
-            loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
-            /**
-                * Applies an `EnvironmentMapConfiguration` to the scene
-                * @param environmentMapConfiguration Environment map configuration to apply
-                */
-            applyEnvironmentMapConfiguration(rotationY?: number): void;
-            /**
-                * Get an environment asset url by using the configuration if the path is not absolute.
-                * @param url Asset url
-                * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
-                */
-            getAssetUrl(url: string): string;
-            rotateShadowLight(shadowLight: BABYLON.ShadowLight, amount: number, point?: BABYLON.Vector3, axis?: BABYLON.Vector3, target?: BABYLON.Vector3): void;
-    }
-}
-declare module BabylonViewer {
-    /**
         * Defines an animation to be applied to a model (translation, scale or rotation).
         */
     export interface IModelAnimationConfiguration {
@@ -1728,6 +1435,54 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
+    /**
+        * The ViewerLabs class will hold functions that are not (!) backwards compatible.
+        * The APIs in all labs-related classes and configuration  might change.
+        * Once stable, lab features will be moved to the publis API and configuration object.
+        */
+    export class ViewerLabs {
+            constructor(_scene: BABYLON.Scene);
+            assetsRootURL: string;
+            environment: PBREnvironment;
+            /**
+                        * Loads an environment map from a given URL
+                        * @param url URL of environment map
+                        * @param onSuccess Callback fired after environment successfully applied to the scene
+                        * @param onProgress Callback fired at progress events while loading the environment map
+                        * @param onError Callback fired when the load fails
+                        */
+            loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
+            /**
+                * Loads an environment map from a given URL
+                * @param buffer ArrayBuffer containing environment map
+                * @param onSuccess Callback fired after environment successfully applied to the scene
+                * @param onProgress Callback fired at progress events while loading the environment map
+                * @param onError Callback fired when the load fails
+                */
+            loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
+            /**
+                * Sets the environment to an already loaded environment
+                * @param env PBREnvironment instance
+                * @param onSuccess Callback fired after environment successfully applied to the scene
+                * @param onProgress Callback fired at progress events while loading the environment map
+                * @param onError Callback fired when the load fails
+                */
+            loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
+            /**
+                * Applies an `EnvironmentMapConfiguration` to the scene
+                * @param environmentMapConfiguration Environment map configuration to apply
+                */
+            applyEnvironmentMapConfiguration(rotationY?: number): void;
+            /**
+                * Get an environment asset url by using the configuration if the path is not absolute.
+                * @param url Asset url
+                * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
+                */
+            getAssetUrl(url: string): string;
+            rotateShadowLight(shadowLight: BABYLON.ShadowLight, amount: number, point?: BABYLON.Vector3, axis?: BABYLON.Vector3, target?: BABYLON.Vector3): void;
+    }
+}
+declare module BabylonViewer {
     export interface ICameraConfiguration {
         position?: {
             x: number;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 155 - 407
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -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<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)
                 *
@@ -221,262 +221,18 @@ 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;
     }
 }
 
 declare module 'babylonjs-viewer/viewer/viewer' {
-    import { Engine, ISceneLoaderPlugin, ISceneLoaderPluginAsync, Observable, Scene, SceneLoaderProgressEvent } from 'babylonjs';
-    import { IModelConfiguration, IObserversConfiguration, ViewerConfiguration } from 'babylonjs-viewer/configuration';
-    import { ConfigurationContainer } from 'babylonjs-viewer/configuration/configurationContainer';
-    import { ConfigurationLoader } from 'babylonjs-viewer/configuration/loader';
-    import { ModelLoader } from 'babylonjs-viewer/loader/modelLoader';
-    import { ObservablesManager } from 'babylonjs-viewer/managers/observablesManager';
-    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
-    import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
-    import { TemplateManager } from 'babylonjs-viewer/templating/templateManager';
-    /**
-        * The AbstractViewr is the center of Babylon's 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;
-            /**
-                * The corresponsing template manager of this viewer.
-                */
-            templateManager: TemplateManager;
-            /**
-                * Babylon Engine corresponding with this viewer
-                */
-            engine: Engine;
-            /**
-                * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
-                */
-            readonly baseId: string;
-            /**
-                * The last loader used to load a model.
-                * @deprecated
-                */
-            lastUsedLoader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-            /**
-                * The ModelLoader instance connected with this viewer.
-                */
-            modelLoader: ModelLoader;
-            /**
-                * A flag that controls whether or not the render loop should be executed
-                */
-            runRenderLoop: boolean;
-            /**
-                * The scene manager connected with this viewer instance
-                */
-            sceneManager: SceneManager;
-            /**
-                * Will notify when the scene was initialized
-                */
-            readonly onSceneInitObservable: Observable<Scene>;
-            /**
-                * will notify when the engine was initialized
-                */
-            readonly onEngineInitObservable: Observable<Engine>;
-            /**
-                * Will notify when a new model was added to the scene.
-                * Note that added does not neccessarily mean loaded!
-                */
-            readonly onModelAddedObservable: Observable<ViewerModel>;
-            /**
-                * will notify after every model load
-                */
-            readonly onModelLoadedObservable: Observable<ViewerModel>;
-            /**
-                * will notify when any model notify of progress
-                */
-            readonly onModelLoadProgressObservable: Observable<SceneLoaderProgressEvent>;
-            /**
-                * will notify when any model load failed.
-                */
-            readonly onModelLoadErrorObservable: Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will notify when a model was removed from the scene;
-                */
-            readonly onModelRemovedObservable: Observable<ViewerModel>;
-            /**
-                * will notify when a new loader was initialized.
-                * Used mainly to know when a model starts loading.
-                */
-            readonly onLoaderInitObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-            /**
-                * Observers registered here will be executed when the entire load process has finished.
-                */
-            readonly onInitDoneObservable: Observable<AbstractViewer>;
-            /**
-                * Functions added to this observable will be executed on each frame rendered.
-                */
-            readonly onFrameRenderedObservable: Observable<AbstractViewer>;
-            /**
-                * Observers registered here will be executed when VR more is entered.
-                */
-            readonly onEnteringVRObservable: Observable<AbstractViewer>;
-            /**
-                * Observers registered here will be executed when VR mode is exited.
-                */
-            readonly onExitingVRObservable: Observable<AbstractViewer>;
-            observablesManager: ObservablesManager;
-            /**
-                * The canvas associated with this viewer
-                */
-            protected _canvas: HTMLCanvasElement;
-            /**
-                * The (single) canvas of this viewer
-                */
-            readonly canvas: HTMLCanvasElement;
-            /**
-                * is this viewer disposed?
-                */
-            protected _isDisposed: boolean;
-            /**
-                * registered onBeforeRender functions.
-                * This functions are also registered at the native scene. The reference can be used to unregister them.
-                */
-            protected _registeredOnBeforeRenderFunctions: Array<() => void>;
-            /**
-                * The configuration loader of this viewer
-                */
-            protected _configurationLoader: ConfigurationLoader;
-            /**
-                * Is the viewer already initialized. for internal use.
-                */
-            protected _isInit: boolean;
-            protected _configurationContainer: ConfigurationContainer;
-            readonly configurationContainer: ConfigurationContainer;
-            constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
-            /**
-                * get the baseId of this viewer
-                */
-            getBaseId(): string;
-            /**
-                * Do we have a canvas to render on, and is it a part of the scene
-                */
-            isCanvasInDOM(): boolean;
-            /**
-             * Set the viewer's background rendering flag.
-             */
-            renderInBackground: boolean;
-            /**
-                * Get the configuration object. This is a reference only.
-                * The configuration can ONLY be updated using the updateConfiguration function.
-                * changing this object will have no direct effect on the scene.
-                */
-            readonly configuration: ViewerConfiguration;
-            /**
-                * force resizing the engine.
-                */
-            forceResize(): void;
-            protected _hdToggled: boolean;
-            toggleHD(): void;
-            protected _vrToggled: boolean;
-            protected _vrScale: number;
-            protected _vrInit: boolean;
-            toggleVR(): void;
-            protected _initVR(): void;
-            /**
-                * The resize function that will be registered with the window object
-                */
-            protected _resize: () => void;
-            protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
-            /**
-                * Force a single render loop execution.
-                */
-            forceRender(): void;
-            /**
-                * render loop that will be executed by the engine
-                */
-            protected _render: (force?: boolean) => void;
-            /**
-                * Takes a screenshot of the scene and returns it as a base64 encoded png.
-                * @param callback optional callback that will be triggered when screenshot is done.
-                * @param width Optional screenshot width (default to 512).
-                * @param height Optional screenshot height (default to 512).
-                * @returns a promise with the screenshot data
-                */
-            takeScreenshot(callback?: (data: string) => void, width?: number, height?: number): Promise<string>;
-            /**
-                * Update the current viewer configuration with new values.
-                * Only provided information will be updated, old configuration values will be kept.
-                * If this.configuration was manually changed, you can trigger this function with no parameters,
-                * and the entire configuration will be updated.
-                * @param newConfiguration the partial configuration to update or a URL to a JSON holding the updated configuration
-                *
-                */
-            updateConfiguration(newConfiguration?: Partial<ViewerConfiguration> | string): void;
-            /**
-                * this is used to register native functions using the configuration object.
-                * This will configure the observers.
-                * @param observersConfiguration observers configuration
-                */
-            protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
-            /**
-                * Dispose the entire viewer including the scene and the engine
-                */
-            dispose(): void;
-            /**
-                * This will prepare the container element for the viewer
-                */
-            protected abstract _prepareContainerElement(): any;
-            /**
-                * This function will execute when the HTML templates finished initializing.
-                * It should initialize the engine and continue execution.
-                *
-                * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
-                */
-            protected _onTemplatesLoaded(): Promise<AbstractViewer>;
-            /**
-                * This will force the creation of an engine and a scene.
-                * It will also load a model if preconfigured.
-                * But first - it will load the extendible onTemplateLoaded()!
-                */
-            protected _onTemplateLoaded(): Promise<AbstractViewer>;
-            /**
-                * Initialize the engine. Retruns a promise in case async calls are needed.
-                *
-                * @protected
-                * @returns {Promise<Engine>}
-                * @memberof Viewer
-                */
-            protected _initEngine(): Promise<Engine>;
-            /**
-                * Initialize a model loading. The returned object (a ViewerModel object) will be loaded in the background.
-                * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
-                *
-                * @param modelConfig model configuration to use when loading the model.
-                * @param clearScene should the scene be cleared before loading this model
-                * @returns a ViewerModel object that is not yet fully loaded.
-                */
-            initModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): ViewerModel;
-            /**
-                * load a model using the provided configuration.
-                * This function, as opposed to initModel, will return a promise that resolves when the model is loaded, and rejects with error.
-                * If you want to attach to the observables of the model, use initModle instead.
-                *
-                * @param modelConfig the model configuration or URL to load.
-                * @param clearScene Should the scene be cleared before loading the model
-                * @returns a Promise the fulfills when the model finished loading successfully.
-                */
-            loadModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): Promise<ViewerModel>;
-            protected _initTelemetryEvents(): void;
-            /**
-                * Injects all the spectre shader in the babylon shader store
-                */
-            protected _injectCustomShaders(): void;
-    }
+    
 }
 
 declare module 'babylonjs-viewer/managers/telemetryManager' {
@@ -985,13 +741,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;
 }
 
@@ -1294,28 +1051,71 @@ declare module 'babylonjs-viewer/configuration/configurationContainer' {
     }
 }
 
-declare module 'babylonjs-viewer/configuration/loader' {
-    import { ViewerConfiguration } from 'babylonjs-viewer/configuration/configuration';
-    /**
-        * The configuration loader will load the configuration object from any source and will use the defined mapper to
-        * parse the object and return a conform ViewerConfiguration.
-        * It is a private member of the scene.
-        */
-    export class ConfigurationLoader {
-            constructor(_enableCache?: boolean);
+declare module 'babylonjs-viewer/configuration/interfaces/modelConfiguration' {
+    import { IModelAnimationConfiguration } from "babylonjs-viewer/configuration/interfaces/modelAnimationConfiguration";
+    export interface IModelConfiguration {
+            id?: string;
+            url?: string;
+            root?: string;
+            file?: string | File;
+            loader?: string;
+            position?: {
+                    x: number;
+                    y: number;
+                    z: number;
+            };
+            rotation?: {
+                    x: number;
+                    y: number;
+                    z: number;
+                    w?: number;
+            };
+            scaling?: {
+                    x: number;
+                    y: number;
+                    z: number;
+            };
+            parentObjectIndex?: number;
+            castShadow?: boolean;
+            receiveShadows?: boolean;
+            normalize?: boolean | {
+                    center?: boolean;
+                    unitSize?: boolean;
+                    parentIndex?: number;
+            };
+            title?: string;
+            subtitle?: string;
+            thumbnail?: string;
+            animation?: {
+                    autoStart?: boolean | string;
+                    playOnce?: boolean;
+                    autoStartIndex?: number;
+            };
+            entryAnimation?: IModelAnimationConfiguration;
+            exitAnimation?: IModelAnimationConfiguration;
+            material?: {
+                    directEnabled?: boolean;
+                    directIntensity?: number;
+                    emissiveIntensity?: number;
+                    environmentIntensity?: number;
+                    [propName: string]: any;
+            };
             /**
-                * load a configuration object that is defined in the initial configuration provided.
-                * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
-                *
-                * @param initConfig the initial configuration that has the definitions of further configuration to load.
-                * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
-                * @returns A promise that delivers the extended viewer configuration, when done.
+                * Rotation offset axis definition
                 */
-            loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
+            rotationOffsetAxis?: {
+                    x: number;
+                    y: number;
+                    z: number;
+            };
             /**
-                * Dispose the configuration loader. This will cancel file requests, if active.
+                * the offset angle
                 */
-            dispose(): void;
+            rotationOffsetAngle?: number;
+            loaderConfiguration?: {
+                    maxLODsToLoad?: number;
+                    progressiveLoading?: boolean;
+            };
     }
 }
 
@@ -1385,6 +1185,42 @@ declare module 'babylonjs-viewer/managers/observablesManager' {
     }
 }
 
+declare module 'babylonjs-viewer/loader/plugins' {
+    import { TelemetryLoaderPlugin } from "babylonjs-viewer/loader/plugins/telemetryLoaderPlugin";
+    import { ILoaderPlugin } from "babylonjs-viewer/loader/plugins/loaderPlugin";
+    import { MSFTLodLoaderPlugin } from 'babylonjs-viewer/loader/plugins/msftLodLoaderPlugin';
+    import { ApplyMaterialConfigPlugin } from 'babylonjs-viewer/loader/plugins/applyMaterialConfig';
+    import { ExtendedMaterialLoaderPlugin } from 'babylonjs-viewer/loader/plugins/extendedMaterialLoaderPlugin';
+    export { TelemetryLoaderPlugin, ILoaderPlugin, MSFTLodLoaderPlugin, ApplyMaterialConfigPlugin, ExtendedMaterialLoaderPlugin };
+    /**
+        * Get a loader plugin according to its name.
+        * The plugin will be cached and will be reused if called for again.
+        *
+        * @param name the name of the plugin
+        */
+    export function getLoaderPluginByName(name: string): ILoaderPlugin;
+    /**
+        *
+        */
+    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/managers/sceneManager' {
     import { Scene, ArcRotateCamera, Engine, Light, SceneOptimizer, EnvironmentHelper, Color3, Observable, DefaultRenderingPipeline, Nullable, VRExperienceHelper } from 'babylonjs';
     import { ILightConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, ICameraConfiguration, ISkyboxConfiguration, ViewerConfiguration, IGroundConfiguration, IModelConfiguration, IVRConfiguration } from 'babylonjs-viewer/configuration';
@@ -1574,94 +1410,6 @@ declare module 'babylonjs-viewer/managers/sceneManager' {
     }
 }
 
-declare module 'babylonjs-viewer/configuration/interfaces/modelConfiguration' {
-    import { IModelAnimationConfiguration } from "babylonjs-viewer/configuration/interfaces/modelAnimationConfiguration";
-    export interface IModelConfiguration {
-            id?: string;
-            url?: string;
-            root?: string;
-            file?: string | File;
-            loader?: string;
-            position?: {
-                    x: number;
-                    y: number;
-                    z: number;
-            };
-            rotation?: {
-                    x: number;
-                    y: number;
-                    z: number;
-                    w?: number;
-            };
-            scaling?: {
-                    x: number;
-                    y: number;
-                    z: number;
-            };
-            parentObjectIndex?: number;
-            castShadow?: boolean;
-            receiveShadows?: boolean;
-            normalize?: boolean | {
-                    center?: boolean;
-                    unitSize?: boolean;
-                    parentIndex?: number;
-            };
-            title?: string;
-            subtitle?: string;
-            thumbnail?: string;
-            animation?: {
-                    autoStart?: boolean | string;
-                    playOnce?: boolean;
-                    autoStartIndex?: number;
-            };
-            entryAnimation?: IModelAnimationConfiguration;
-            exitAnimation?: IModelAnimationConfiguration;
-            material?: {
-                    directEnabled?: boolean;
-                    directIntensity?: number;
-                    emissiveIntensity?: number;
-                    environmentIntensity?: number;
-                    [propName: string]: any;
-            };
-            /**
-                * Rotation offset axis definition
-                */
-            rotationOffsetAxis?: {
-                    x: number;
-                    y: number;
-                    z: number;
-            };
-            /**
-                * the offset angle
-                */
-            rotationOffsetAngle?: number;
-            loaderConfiguration?: {
-                    maxLODsToLoad?: number;
-                    progressiveLoading?: boolean;
-            };
-    }
-}
-
-declare module 'babylonjs-viewer/loader/plugins' {
-    import { TelemetryLoaderPlugin } from "babylonjs-viewer/loader/plugins/telemetryLoaderPlugin";
-    import { ILoaderPlugin } from "babylonjs-viewer/loader/plugins/loaderPlugin";
-    import { MSFTLodLoaderPlugin } from 'babylonjs-viewer/loader/plugins/msftLodLoaderPlugin';
-    import { ApplyMaterialConfigPlugin } from 'babylonjs-viewer/loader/plugins/applyMaterialConfig';
-    import { ExtendedMaterialLoaderPlugin } from 'babylonjs-viewer/loader/plugins/extendedMaterialLoaderPlugin';
-    export { TelemetryLoaderPlugin, ILoaderPlugin, MSFTLodLoaderPlugin, ApplyMaterialConfigPlugin, ExtendedMaterialLoaderPlugin };
-    /**
-        * Get a loader plugin according to its name.
-        * The plugin will be cached and will be reused if called for again.
-        *
-        * @param name the name of the plugin
-        */
-    export function getLoaderPluginByName(name: string): ILoaderPlugin;
-    /**
-        *
-        */
-    export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
@@ -1740,57 +1488,6 @@ declare module 'babylonjs-viewer/templating/eventManager' {
     }
 }
 
-declare module 'babylonjs-viewer/labs/viewerLabs' {
-    import { PBREnvironment } from "babylonjs-viewer/labs/environmentSerializer";
-    import { ShadowLight, Vector3, Scene } from 'babylonjs';
-    /**
-        * The ViewerLabs class will hold functions that are not (!) backwards compatible.
-        * The APIs in all labs-related classes and configuration  might change.
-        * Once stable, lab features will be moved to the publis API and configuration object.
-        */
-    export class ViewerLabs {
-            constructor(_scene: Scene);
-            assetsRootURL: string;
-            environment: PBREnvironment;
-            /**
-                        * Loads an environment map from a given URL
-                        * @param url URL of environment map
-                        * @param onSuccess Callback fired after environment successfully applied to the scene
-                        * @param onProgress Callback fired at progress events while loading the environment map
-                        * @param onError Callback fired when the load fails
-                        */
-            loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
-            /**
-                * Loads an environment map from a given URL
-                * @param buffer ArrayBuffer containing environment map
-                * @param onSuccess Callback fired after environment successfully applied to the scene
-                * @param onProgress Callback fired at progress events while loading the environment map
-                * @param onError Callback fired when the load fails
-                */
-            loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
-            /**
-                * Sets the environment to an already loaded environment
-                * @param env PBREnvironment instance
-                * @param onSuccess Callback fired after environment successfully applied to the scene
-                * @param onProgress Callback fired at progress events while loading the environment map
-                * @param onError Callback fired when the load fails
-                */
-            loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
-            /**
-                * Applies an `EnvironmentMapConfiguration` to the scene
-                * @param environmentMapConfiguration Environment map configuration to apply
-                */
-            applyEnvironmentMapConfiguration(rotationY?: number): void;
-            /**
-                * Get an environment asset url by using the configuration if the path is not absolute.
-                * @param url Asset url
-                * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
-                */
-            getAssetUrl(url: string): string;
-            rotateShadowLight(shadowLight: ShadowLight, amount: number, point?: Vector3, axis?: Vector3, target?: Vector3): void;
-    }
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces/modelAnimationConfiguration' {
     /**
         * Defines an animation to be applied to a model (translation, scale or rotation).
@@ -1871,6 +1568,57 @@ declare module 'babylonjs-viewer/loader/plugins/extendedMaterialLoaderPlugin' {
     }
 }
 
+declare module 'babylonjs-viewer/labs/viewerLabs' {
+    import { PBREnvironment } from "babylonjs-viewer/labs/environmentSerializer";
+    import { ShadowLight, Vector3, Scene } from 'babylonjs';
+    /**
+        * The ViewerLabs class will hold functions that are not (!) backwards compatible.
+        * The APIs in all labs-related classes and configuration  might change.
+        * Once stable, lab features will be moved to the publis API and configuration object.
+        */
+    export class ViewerLabs {
+            constructor(_scene: Scene);
+            assetsRootURL: string;
+            environment: PBREnvironment;
+            /**
+                        * Loads an environment map from a given URL
+                        * @param url URL of environment map
+                        * @param onSuccess Callback fired after environment successfully applied to the scene
+                        * @param onProgress Callback fired at progress events while loading the environment map
+                        * @param onError Callback fired when the load fails
+                        */
+            loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
+            /**
+                * Loads an environment map from a given URL
+                * @param buffer ArrayBuffer containing environment map
+                * @param onSuccess Callback fired after environment successfully applied to the scene
+                * @param onProgress Callback fired at progress events while loading the environment map
+                * @param onError Callback fired when the load fails
+                */
+            loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
+            /**
+                * Sets the environment to an already loaded environment
+                * @param env PBREnvironment instance
+                * @param onSuccess Callback fired after environment successfully applied to the scene
+                * @param onProgress Callback fired at progress events while loading the environment map
+                * @param onError Callback fired when the load fails
+                */
+            loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
+            /**
+                * Applies an `EnvironmentMapConfiguration` to the scene
+                * @param environmentMapConfiguration Environment map configuration to apply
+                */
+            applyEnvironmentMapConfiguration(rotationY?: number): void;
+            /**
+                * Get an environment asset url by using the configuration if the path is not absolute.
+                * @param url Asset url
+                * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
+                */
+            getAssetUrl(url: string): string;
+            rotateShadowLight(shadowLight: ShadowLight, amount: number, point?: Vector3, axis?: Vector3, target?: Vector3): void;
+    }
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces/cameraConfiguration' {
     export interface ICameraConfiguration {
         position?: {

+ 81 - 60
src/Mesh/babylon.mesh.ts

@@ -1,4 +1,34 @@
 module BABYLON {
+
+    /**
+     * @hidden
+     **/
+    export class _CreationDataStorage {
+        public closePath?: boolean;
+        public idx: number[];
+        public dashSize: number;
+        public gapSize: number;
+        public path3D: Path3D;
+        public pathArray: Vector3[][];
+        public arc: number;
+        public radius: number;   
+        public cap: number;
+        public tessellation: number
+    }
+
+    /**
+     * @hidden
+     **/
+    class _InstanceDataStorage {
+        public visibleInstances: any = {};
+        public renderIdForInstances = new Array<number>();
+        public batchCache = new _InstancesBatch();
+        public instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances
+        public instancesBuffer: Nullable<Buffer>;
+        public instancesData: Float32Array;
+        public overridenInstanceCount: number;
+    }
+
     /**
      * @hidden
      **/
@@ -148,6 +178,9 @@
 
         // Private
         /** @hidden */
+        public _creationDataStorage: Nullable<_CreationDataStorage>;
+
+        /** @hidden */
         public _geometry: Nullable<Geometry>;
         /** @hidden */
         public _delayInfo: Array<string>;
@@ -155,13 +188,7 @@
         public _delayLoadingFunction: (any: any, mesh: Mesh) => void;
 
         /** @hidden */
-        public _visibleInstances: any = {};
-        private _renderIdForInstances = new Array<number>();
-        private _batchCache = new _InstancesBatch();
-        private _instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances
-        private _instancesBuffer: Nullable<Buffer>;
-        private _instancesData: Float32Array;
-        private _overridenInstanceCount: number;
+        public _instanceDataStorage = new _InstanceDataStorage();
 
         private _effectiveMaterial: Material;
 
@@ -242,16 +269,7 @@
                 // Construction Params
                 // Clone parameters allowing mesh to be updated in case of parametric shapes.
                 this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;
-                const myAnyThis = this as any;
-                const myAnySource = source as any;
-                myAnyThis._closePath = myAnySource._closePath;
-                myAnyThis._idx = myAnySource._idx;
-                myAnyThis.dashSize = myAnySource.dashSize;
-                myAnyThis.gapSize = myAnySource.gapSize;
-                myAnyThis.path3D = myAnySource.path3D;
-                myAnyThis.pathArray = myAnySource.pathArray;
-                myAnyThis.arc = myAnySource.arc;
-                myAnyThis.radius = myAnySource.radius;
+                this._creationDataStorage = source._creationDataStorage;
 
                 // Animation ranges
                 if (this._source._ranges) {
@@ -816,7 +834,7 @@
          * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
          */
         public set overridenInstanceCount(count: number) {
-            this._overridenInstanceCount = count;
+            this._instanceDataStorage.overridenInstanceCount = count;
         }
 
         // Methods
@@ -828,31 +846,31 @@
             }
 
             this._preActivateId = sceneRenderId;
-            this._visibleInstances = null;
+            this._instanceDataStorage.visibleInstances = null;
             return this;
         }
 
         /** @hidden */
         public _preActivateForIntermediateRendering(renderId: number): Mesh {
-            if (this._visibleInstances) {
-                this._visibleInstances.intermediateDefaultRenderId = renderId;
+            if (this._instanceDataStorage.visibleInstances) {
+                this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;
             }
             return this;
         }
 
         /** @hidden */
         public _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): Mesh {
-            if (!this._visibleInstances) {
-                this._visibleInstances = {};
-                this._visibleInstances.defaultRenderId = renderId;
-                this._visibleInstances.selfDefaultRenderId = this._renderId;
+            if (!this._instanceDataStorage.visibleInstances) {
+                this._instanceDataStorage.visibleInstances = {};
+                this._instanceDataStorage.visibleInstances.defaultRenderId = renderId;
+                this._instanceDataStorage.visibleInstances.selfDefaultRenderId = this._renderId;
             }
 
-            if (!this._visibleInstances[renderId]) {
-                this._visibleInstances[renderId] = new Array<InstancedMesh>();
+            if (!this._instanceDataStorage.visibleInstances[renderId]) {
+                this._instanceDataStorage.visibleInstances[renderId] = new Array<InstancedMesh>();
             }
 
-            this._visibleInstances[renderId].push(instance);
+            this._instanceDataStorage.visibleInstances[renderId].push(instance);
             return this;
         }
 
@@ -1338,38 +1356,40 @@
         /** @hidden */
         public _getInstancesRenderList(subMeshId: number): _InstancesBatch {
             var scene = this.getScene();
-            this._batchCache.mustReturn = false;
-            this._batchCache.renderSelf[subMeshId] = this.isEnabled() && this.isVisible;
-            this._batchCache.visibleInstances[subMeshId] = null;
+            let batchCache = this._instanceDataStorage.batchCache;
+            batchCache.mustReturn = false;
+            batchCache.renderSelf[subMeshId] = this.isEnabled() && this.isVisible;
+            batchCache.visibleInstances[subMeshId] = null;
 
-            if (this._visibleInstances) {
+            if (this._instanceDataStorage.visibleInstances) {
+                let visibleInstances = this._instanceDataStorage.visibleInstances;
                 var currentRenderId = scene.getRenderId();
-                var defaultRenderId = (scene._isInIntermediateRendering() ? this._visibleInstances.intermediateDefaultRenderId : this._visibleInstances.defaultRenderId);
-                this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[currentRenderId];
+                var defaultRenderId = (scene._isInIntermediateRendering() ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId);
+                batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];
                 var selfRenderId = this._renderId;
 
-                if (!this._batchCache.visibleInstances[subMeshId] && defaultRenderId) {
-                    this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[defaultRenderId];
+                if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {
+                    batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];
                     currentRenderId = Math.max(defaultRenderId, currentRenderId);
-                    selfRenderId = Math.max(this._visibleInstances.selfDefaultRenderId, currentRenderId);
+                    selfRenderId = Math.max(visibleInstances.selfDefaultRenderId, currentRenderId);
                 }
 
-                let visibleInstancesForSubMesh = this._batchCache.visibleInstances[subMeshId];
+                let visibleInstancesForSubMesh = batchCache.visibleInstances[subMeshId];
                 if (visibleInstancesForSubMesh && visibleInstancesForSubMesh.length) {
-                    if (this._renderIdForInstances[subMeshId] === currentRenderId) {
-                        this._batchCache.mustReturn = true;
-                        return this._batchCache;
+                    if (this._instanceDataStorage.renderIdForInstances[subMeshId] === currentRenderId) {
+                        batchCache.mustReturn = true;
+                        return batchCache;
                     }
 
                     if (currentRenderId !== selfRenderId) {
-                        this._batchCache.renderSelf[subMeshId] = false;
+                        batchCache.renderSelf[subMeshId] = false;
                     }
 
                 }
-                this._renderIdForInstances[subMeshId] = currentRenderId;
+                this._instanceDataStorage.renderIdForInstances[subMeshId] = currentRenderId;
             }
 
-            return this._batchCache;
+            return batchCache;
         }
 
         /** @hidden */
@@ -1382,15 +1402,16 @@
             var matricesCount = visibleInstances.length + 1;
             var bufferSize = matricesCount * 16 * 4;
 
-            var currentInstancesBufferSize = this._instancesBufferSize;
-            var instancesBuffer = this._instancesBuffer;
+            let instanceStorage = this._instanceDataStorage;
+            var currentInstancesBufferSize = instanceStorage.instancesBufferSize;
+            var instancesBuffer = instanceStorage.instancesBuffer;
 
-            while (this._instancesBufferSize < bufferSize) {
-                this._instancesBufferSize *= 2;
+            while (instanceStorage.instancesBufferSize < bufferSize) {
+                instanceStorage.instancesBufferSize *= 2;
             }
 
-            if (!this._instancesData || currentInstancesBufferSize != this._instancesBufferSize) {
-                this._instancesData = new Float32Array(this._instancesBufferSize / 4);
+            if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {
+                instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);
             }
 
             var offset = 0;
@@ -1398,7 +1419,7 @@
 
             var world = this.getWorldMatrix();
             if (batch.renderSelf[subMesh._id]) {
-                world.copyToArray(this._instancesData, offset);
+                world.copyToArray(instanceStorage.instancesData, offset);
                 offset += 16;
                 instancesCount++;
             }
@@ -1406,26 +1427,26 @@
             if (visibleInstances) {
                 for (var instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {
                     var instance = visibleInstances[instanceIndex];
-                    instance.getWorldMatrix().copyToArray(this._instancesData, offset);
+                    instance.getWorldMatrix().copyToArray(instanceStorage.instancesData, offset);
                     offset += 16;
                     instancesCount++;
                 }
             }
 
-            if (!instancesBuffer || currentInstancesBufferSize != this._instancesBufferSize) {
+            if (!instancesBuffer || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {
                 if (instancesBuffer) {
                     instancesBuffer.dispose();
                 }
 
-                instancesBuffer = new Buffer(engine, this._instancesData, true, 16, false, true);
-                this._instancesBuffer = instancesBuffer;
+                instancesBuffer = new Buffer(engine, instanceStorage.instancesData, true, 16, false, true);
+                instanceStorage.instancesBuffer = instancesBuffer;
 
                 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world0", 0, 4));
                 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world1", 4, 4));
                 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world2", 8, 4));
                 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world3", 12, 4));
             } else {
-                instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
+                instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);
             }
 
             this._bind(subMesh, effect, fillMode);
@@ -1450,7 +1471,7 @@
                         onBeforeDraw(false, this.getWorldMatrix(), effectiveMaterial);
                     }
 
-                    this._draw(subMesh, fillMode, this._overridenInstanceCount);
+                    this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);
                 }
 
                 let visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];
@@ -1920,9 +1941,9 @@
             this._source = null;
 
             // Instances
-            if (this._instancesBuffer) {
-                this._instancesBuffer.dispose();
-                this._instancesBuffer = null;
+            if (this._instanceDataStorage.instancesBuffer) {
+                this._instanceDataStorage.instancesBuffer.dispose();
+                this._instanceDataStorage.instancesBuffer = null;
             }
 
             while (this.instances.length) {

+ 44 - 31
src/Mesh/babylon.meshBuilder.ts

@@ -1,4 +1,5 @@
 module BABYLON {
+
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -165,8 +166,9 @@
                 Vector3.FromFloatsToRef(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE, Tmp.Vector3[1]);
                 var positionFunction = (positions: FloatArray) => {
                     var minlg = pathArray[0].length;
+                    var mesh = (<Mesh>instance);
                     var i = 0;
-                    var ns = ((<Mesh>instance)._originalBuilderSideOrientation === Mesh.DOUBLESIDE) ? 2 : 1;
+                    var ns = (mesh._originalBuilderSideOrientation === Mesh.DOUBLESIDE) ? 2 : 1;
                     for (var si = 1; si <= ns; si++) {
                         for (var p = 0; p < pathArray.length; p++) {
                             var path = pathArray[p];
@@ -198,7 +200,7 @@
                                 j++;
                                 i += 3;
                             }
-                            if ((<any>instance)._closePath) {
+                            if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {
                                 positions[i] = path[0].x;
                                 positions[i + 1] = path[0].y;
                                 positions[i + 2] = path[0].z;
@@ -236,13 +238,13 @@
                     var params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;
                     VertexData.ComputeNormals(positions, indices, normals, params);
 
-                    if ((<any>instance)._closePath) {
+                    if (instance._creationDataStorage && instance._creationDataStorage.closePath) {
                         var indexFirst: number = 0;
                         var indexLast: number = 0;
                         for (var p = 0; p < pathArray.length; p++) {
-                            indexFirst = (<any>instance)._idx[p] * 3;
+                            indexFirst = instance._creationDataStorage!.idx[p] * 3;
                             if (p + 1 < pathArray.length) {
-                                indexLast = ((<any>instance)._idx[p + 1] - 1) * 3;
+                                indexLast = (instance._creationDataStorage!.idx[p + 1] - 1) * 3;
                             }
                             else {
                                 indexLast = normals.length - 3;
@@ -266,12 +268,13 @@
 
                 var ribbon = new Mesh(name, scene);
                 ribbon._originalBuilderSideOrientation = sideOrientation;
+                ribbon._creationDataStorage = new _CreationDataStorage();
 
                 var vertexData = VertexData.CreateRibbon(options);
                 if (closePath) {
-                    (<any>ribbon)._idx = (<any>vertexData)._idx;
+                    ribbon._creationDataStorage.idx = (<any>vertexData)._idx;
                 }
-                (<any>ribbon)._closePath = closePath;
+                ribbon._creationDataStorage.closePath = closePath;
                 (<any>ribbon)._closeArray = closeArray;
 
                 vertexData.applyToMesh(ribbon, updatable);
@@ -500,7 +503,9 @@
                         lg += curvect.length();
                     }
                     shft = lg / nbSeg;
-                    dashshft = (<any>instance).dashSize * shft / ((<any>instance).dashSize + (<any>instance).gapSize);
+                    let dashSize = instance!._creationDataStorage!.dashSize;
+                    let gapSize = instance!._creationDataStorage!.gapSize;
+                    dashshft = dashSize * shft / (dashSize + gapSize);
                     for (i = 0; i < points.length - 1; i++) {
                         points[i + 1].subtractToRef(points[i], curvect);
                         nb = Math.floor(curvect.length() / shft);
@@ -532,8 +537,10 @@
             var dashedLines = new LinesMesh(name, scene);
             var vertexData = VertexData.CreateDashedLines(options);
             vertexData.applyToMesh(dashedLines, options.updatable);
-            (<any>dashedLines).dashSize = dashSize;
-            (<any>dashedLines).gapSize = gapSize;
+
+            dashedLines._creationDataStorage = new _CreationDataStorage();
+            dashedLines._creationDataStorage.dashSize = dashSize;
+            dashedLines._creationDataStorage.gapSize = gapSize;
             return dashedLines;
         }
 
@@ -940,12 +947,13 @@
             var path = options.path;
             var instance = options.instance;
             var radius = 1.0;
-            if (instance) {
-                radius = (<any>instance).radius;
-            }
+            
             if (options.radius !== undefined) {
                 radius = options.radius;
-            };
+            } else if (instance) {
+                radius = instance._creationDataStorage!.radius;
+            }
+
             var tessellation = options.tessellation || 64 | 0;
             var radiusFunction = options.radiusFunction || null;
             var cap = options.cap || Mesh.NO_CAP;
@@ -1020,13 +1028,15 @@
             var pathArray;
             if (instance) { // tube update
                 var arc = options.arc || (<any>instance).arc;
-                path3D = ((<any>instance).path3D).update(path);
-                pathArray = tubePathArray(path, path3D, (<any>instance).pathArray, radius, (<any>instance).tessellation, radiusFunction, (<any>instance).cap, arc);
+                let storage = instance._creationDataStorage!;
+                path3D =  storage.path3D.update(path);
+                pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);
                 instance = MeshBuilder.CreateRibbon("", { pathArray: pathArray, instance: instance });
-                (<any>instance).path3D = path3D;
-                (<any>instance).pathArray = pathArray;
-                (<any>instance).arc = arc;
-                (<any>instance).radius = radius;
+                instance._creationDataStorage = new _CreationDataStorage();
+                instance._creationDataStorage.path3D = path3D;
+                instance._creationDataStorage.pathArray = pathArray;
+                instance._creationDataStorage.arc = arc;
+                instance._creationDataStorage.radius = radius;
 
                 return instance;
             }
@@ -1037,12 +1047,13 @@
             cap = (cap < 0 || cap > 3) ? 0 : cap;
             pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);
             var tube = MeshBuilder.CreateRibbon(name, { pathArray: pathArray, closePath: true, closeArray: false, updatable: updatable, sideOrientation: sideOrientation, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);
-            (<any>tube).pathArray = pathArray;
-            (<any>tube).path3D = path3D;
-            (<any>tube).tessellation = tessellation;
-            (<any>tube).cap = cap;
-            (<any>tube).arc = options.arc;
-            (<any>tube).radius = radius;
+            tube._creationDataStorage = new _CreationDataStorage();
+            tube._creationDataStorage.pathArray = pathArray;
+            tube._creationDataStorage.path3D = path3D;
+            tube._creationDataStorage.tessellation = tessellation;
+            tube._creationDataStorage.cap = cap;
+            tube._creationDataStorage.arc = options.arc;
+            tube._creationDataStorage.radius = radius;
 
             return tube;
         }
@@ -1383,8 +1394,9 @@
             var path3D;
             var pathArray;
             if (instance) { // instance update
-                path3D = ((<any>instance).path3D).update(curve);
-                pathArray = extrusionPathArray(shape, curve, (<any>instance).path3D, (<any>instance).pathArray, scale, rotation, scaleFunction, rotateFunction, (<any>instance).cap, custom);
+                let storage = instance._creationDataStorage!;
+                path3D =  storage.path3D.update(curve);
+                pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom);
                 instance = Mesh.CreateRibbon("", pathArray, false, false, 0, scene || undefined, false, 0, instance);
 
                 return instance;
@@ -1395,9 +1407,10 @@
             cap = (cap < 0 || cap > 3) ? 0 : cap;
             pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom);
             var extrudedGeneric = MeshBuilder.CreateRibbon(name, { pathArray: pathArray, closeArray: rbCA, closePath: rbCP, updatable: updtbl, sideOrientation: side, invertUV: invertUV, frontUVs: frontUVs || undefined, backUVs: backUVs || undefined }, scene);
-            (<any>extrudedGeneric).pathArray = pathArray;
-            (<any>extrudedGeneric).path3D = path3D;
-            (<any>extrudedGeneric).cap = cap;
+            extrudedGeneric._creationDataStorage = new _CreationDataStorage();
+            extrudedGeneric._creationDataStorage.pathArray = pathArray;
+            extrudedGeneric._creationDataStorage.path3D = path3D;
+            extrudedGeneric._creationDataStorage.cap = cap;
 
             return extrudedGeneric;
         }