|
@@ -94,7 +94,59 @@ declare module 'babylonjs-viewer/configuration/globals' {
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/viewer/viewerManager' {
|
|
declare module 'babylonjs-viewer/viewer/viewerManager' {
|
|
-
|
|
|
|
|
|
+ import { Observable } from 'babylonjs';
|
|
|
|
+ import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
|
|
|
|
+ /**
|
|
|
|
+ * The viewer manager is the container for all viewers currently registered on this page.
|
|
|
|
+ * It is possible to have more than one viewer on a single page.
|
|
|
|
+ */
|
|
|
|
+ export class ViewerManager {
|
|
|
|
+ /**
|
|
|
|
+ * A callback that will be triggered when a new viewer was added
|
|
|
|
+ */
|
|
|
|
+ onViewerAdded: (viewer: AbstractViewer) => void;
|
|
|
|
+ /**
|
|
|
|
+ * Will notify when a new viewer was added
|
|
|
|
+ */
|
|
|
|
+ onViewerAddedObservable: Observable<AbstractViewer>;
|
|
|
|
+ /**
|
|
|
|
+ * Will notify when a viewer was removed (disposed)
|
|
|
|
+ */
|
|
|
|
+ onViewerRemovedObservable: Observable<string>;
|
|
|
|
+ constructor();
|
|
|
|
+ /**
|
|
|
|
+ * Adding a new viewer to the viewer manager and start tracking it.
|
|
|
|
+ * @param viewer the viewer to add
|
|
|
|
+ */
|
|
|
|
+ addViewer(viewer: AbstractViewer): void;
|
|
|
|
+ /**
|
|
|
|
+ * remove a viewer from the viewer manager
|
|
|
|
+ * @param viewer the viewer to remove
|
|
|
|
+ */
|
|
|
|
+ removeViewer(viewer: AbstractViewer): void;
|
|
|
|
+ /**
|
|
|
|
+ * Get a viewer by its baseId (if the container element has an ID, it is the this is. if not, a random id was assigned)
|
|
|
|
+ * @param id the id of the HTMl element (or the viewer's, if none provided)
|
|
|
|
+ */
|
|
|
|
+ getViewerById(id: string): AbstractViewer;
|
|
|
|
+ /**
|
|
|
|
+ * Get a viewer using a container element
|
|
|
|
+ * @param element the HTML element to search viewers associated with
|
|
|
|
+ */
|
|
|
|
+ getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
|
|
|
|
+ /**
|
|
|
|
+ * Get a promise that will fullfil when this viewer was initialized.
|
|
|
|
+ * Since viewer initialization and template injection is asynchronous, using the promise will guaranty that
|
|
|
|
+ * you will get the viewer after everything was already configured.
|
|
|
|
+ * @param id the viewer id to find
|
|
|
|
+ */
|
|
|
|
+ getViewerPromiseById(id: string): Promise<AbstractViewer>;
|
|
|
|
+ /**
|
|
|
|
+ * dispose the manager and all of its associated viewers
|
|
|
|
+ */
|
|
|
|
+ dispose(): void;
|
|
|
|
+ }
|
|
|
|
+ export let viewerManager: ViewerManager;
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/viewer/defaultViewer' {
|
|
declare module 'babylonjs-viewer/viewer/defaultViewer' {
|
|
@@ -148,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
|
|
* Mainly used for help and errors
|
|
* Mainly used for help and errors
|
|
* @param subScreen the name of the subScreen. Those can be defined in the configuration object
|
|
* @param subScreen the name of the subScreen. Those can be defined in the configuration object
|
|
*/
|
|
*/
|
|
- showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
|
|
|
|
|
|
+ showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
|
|
/**
|
|
/**
|
|
* Hide the overlay screen.
|
|
* Hide the overlay screen.
|
|
*/
|
|
*/
|
|
- hideOverlayScreen(): Promise<Template> | Promise<string>;
|
|
|
|
|
|
+ hideOverlayScreen(): Promise<string> | Promise<Template>;
|
|
/**
|
|
/**
|
|
* show the viewer (in case it was hidden)
|
|
* show the viewer (in case it was hidden)
|
|
*
|
|
*
|
|
@@ -169,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
|
|
* Show the loading screen.
|
|
* Show the loading screen.
|
|
* The loading screen can be configured using the configuration object
|
|
* The loading screen can be configured using the configuration object
|
|
*/
|
|
*/
|
|
- showLoadingScreen(): Promise<Template> | Promise<string>;
|
|
|
|
|
|
+ showLoadingScreen(): Promise<string> | Promise<Template>;
|
|
/**
|
|
/**
|
|
* Hide the loading screen
|
|
* Hide the loading screen
|
|
*/
|
|
*/
|
|
- hideLoadingScreen(): Promise<Template> | Promise<string>;
|
|
|
|
|
|
+ hideLoadingScreen(): Promise<string> | Promise<Template>;
|
|
dispose(): void;
|
|
dispose(): void;
|
|
protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
|
|
protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
|
|
}
|
|
}
|
|
@@ -933,14 +985,13 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/optimizer/custom' {
|
|
declare module 'babylonjs-viewer/optimizer/custom' {
|
|
- import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
|
|
|
|
import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
|
|
import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* @param name the name of the custom optimizer configuration
|
|
* @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
|
|
* @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
|
|
*/
|
|
*/
|
|
- export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
|
|
|
|
|
|
+ export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
|
|
export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
|
|
export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1611,22 +1662,6 @@ declare module 'babylonjs-viewer/loader/plugins' {
|
|
export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
|
|
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' {
|
|
declare module 'babylonjs-viewer/configuration/interfaces' {
|
|
export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
|
|
export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
|
|
export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
|
|
export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
|