|
@@ -200,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<string> | Promise<Template>;
|
|
|
|
|
|
+ showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
|
|
/**
|
|
/**
|
|
* Hide the overlay screen.
|
|
* Hide the overlay screen.
|
|
*/
|
|
*/
|
|
- hideOverlayScreen(): Promise<string> | Promise<Template>;
|
|
|
|
|
|
+ hideOverlayScreen(): Promise<Template> | Promise<string>;
|
|
/**
|
|
/**
|
|
* show the viewer (in case it was hidden)
|
|
* show the viewer (in case it was hidden)
|
|
*
|
|
*
|
|
@@ -221,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<string> | Promise<Template>;
|
|
|
|
|
|
+ showLoadingScreen(): Promise<Template> | Promise<string>;
|
|
/**
|
|
/**
|
|
* Hide the loading screen
|
|
* Hide the loading screen
|
|
*/
|
|
*/
|
|
- hideLoadingScreen(): Promise<string> | Promise<Template>;
|
|
|
|
|
|
+ hideLoadingScreen(): Promise<Template> | Promise<string>;
|
|
dispose(): void;
|
|
dispose(): void;
|
|
protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
|
|
protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
|
|
}
|
|
}
|
|
@@ -527,7 +527,42 @@ declare module 'babylonjs-viewer/managers/telemetryManager' {
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/loader/modelLoader' {
|
|
declare module 'babylonjs-viewer/loader/modelLoader' {
|
|
-
|
|
|
|
|
|
+ import { ConfigurationContainer } from 'babylonjs-viewer/configuration/configurationContainer';
|
|
|
|
+ import { IModelConfiguration } from 'babylonjs-viewer/configuration/interfaces/modelConfiguration';
|
|
|
|
+ import { ObservablesManager } from 'babylonjs-viewer/managers/observablesManager';
|
|
|
|
+ import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
|
|
|
|
+ import { ILoaderPlugin } from 'babylonjs-viewer/loader/plugins';
|
|
|
|
+ /**
|
|
|
|
+ * An instance of the class is in charge of loading the model correctly.
|
|
|
|
+ * This class will continously be expended with tasks required from the specific loaders Babylon has.
|
|
|
|
+ *
|
|
|
|
+ * A Model loader is unique per (Abstract)Viewer. It is being generated by the viewer
|
|
|
|
+ */
|
|
|
|
+ export class ModelLoader {
|
|
|
|
+ readonly baseUrl: string;
|
|
|
|
+ /**
|
|
|
|
+ * Create a new Model loader
|
|
|
|
+ * @param _viewer the viewer using this model loader
|
|
|
|
+ */
|
|
|
|
+ constructor(_observablesManager: ObservablesManager, _configurationContainer?: ConfigurationContainer | undefined);
|
|
|
|
+ /**
|
|
|
|
+ * Adds a new plugin to the loader process.
|
|
|
|
+ *
|
|
|
|
+ * @param plugin the plugin name or the plugin itself
|
|
|
|
+ */
|
|
|
|
+ addPlugin(plugin: ILoaderPlugin | string): void;
|
|
|
|
+ /**
|
|
|
|
+ * Load a model using predefined configuration
|
|
|
|
+ * @param modelConfiguration the modelConfiguration to use to load the model
|
|
|
|
+ */
|
|
|
|
+ load(modelConfiguration: IModelConfiguration): ViewerModel;
|
|
|
|
+ cancelLoad(model: ViewerModel): void;
|
|
|
|
+ /**
|
|
|
|
+ * dispose the model loader.
|
|
|
|
+ * If loaders are registered and are in the middle of loading, they will be disposed and the request(s) will be cancelled.
|
|
|
|
+ */
|
|
|
|
+ dispose(): void;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/model/viewerModel' {
|
|
declare module 'babylonjs-viewer/model/viewerModel' {
|
|
@@ -950,13 +985,14 @@ 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): (sceneManager: SceneManager) => boolean;
|
|
|
|
|
|
+ export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
|
|
export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
|
|
export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1607,6 +1643,42 @@ declare module 'babylonjs-viewer/configuration/interfaces/modelConfiguration' {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+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/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';
|
|
@@ -1765,6 +1837,57 @@ declare module 'babylonjs-viewer/configuration/interfaces/modelAnimationConfigur
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+declare module 'babylonjs-viewer/loader/plugins/telemetryLoaderPlugin' {
|
|
|
|
+ import { ILoaderPlugin } from "babylonjs-viewer/loader/plugins/loaderPlugin";
|
|
|
|
+ import { ViewerModel } from "babylonjs-viewer/model/viewerModel";
|
|
|
|
+ import { ISceneLoaderPlugin, ISceneLoaderPluginAsync } from "babylonjs";
|
|
|
|
+ export class TelemetryLoaderPlugin implements ILoaderPlugin {
|
|
|
|
+ onInit(loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync, model: ViewerModel): void;
|
|
|
|
+ onLoaded(model: ViewerModel): void;
|
|
|
|
+ onError(message: string, exception: any): void;
|
|
|
|
+ onComplete(): void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module 'babylonjs-viewer/loader/plugins/msftLodLoaderPlugin' {
|
|
|
|
+ import { ISceneLoaderPlugin, ISceneLoaderPluginAsync } from 'babylonjs';
|
|
|
|
+ import { IGLTFLoaderExtension } from 'babylonjs-loaders';
|
|
|
|
+ import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
|
|
|
|
+ import { ILoaderPlugin } from 'babylonjs-viewer/loader/plugins/loaderPlugin';
|
|
|
|
+ /**
|
|
|
|
+ * A loder plugin to use MSFT_lod extension correctly (glTF)
|
|
|
|
+ */
|
|
|
|
+ export class MSFTLodLoaderPlugin implements ILoaderPlugin {
|
|
|
|
+ onInit(loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync, model: ViewerModel): void;
|
|
|
|
+ onExtensionLoaded(extension: IGLTFLoaderExtension): void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module 'babylonjs-viewer/loader/plugins/applyMaterialConfig' {
|
|
|
|
+ import { ISceneLoaderPlugin, ISceneLoaderPluginAsync, Material } from 'babylonjs';
|
|
|
|
+ import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
|
|
|
|
+ import { ILoaderPlugin } from 'babylonjs-viewer/loader/plugins/loaderPlugin';
|
|
|
|
+ /**
|
|
|
|
+ * Force-apply material configuration right after a material was loaded.
|
|
|
|
+ */
|
|
|
|
+ export class ApplyMaterialConfigPlugin implements ILoaderPlugin {
|
|
|
|
+ onInit(loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync, model: ViewerModel): void;
|
|
|
|
+ onMaterialLoaded(material: Material): void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module 'babylonjs-viewer/loader/plugins/extendedMaterialLoaderPlugin' {
|
|
|
|
+ import { Material } from 'babylonjs';
|
|
|
|
+ import { ILoaderPlugin } from 'babylonjs-viewer/loader/plugins/loaderPlugin';
|
|
|
|
+ /**
|
|
|
|
+ * A (PBR) material will be extended using this function.
|
|
|
|
+ * This function will hold extra default configuration for the viewer, if not implemented in Babylon itself.
|
|
|
|
+ */
|
|
|
|
+ export class ExtendedMaterialLoaderPlugin implements ILoaderPlugin {
|
|
|
|
+ onMaterialLoaded(baseMaterial: Material): void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
declare module 'babylonjs-viewer/configuration/interfaces/cameraConfiguration' {
|
|
declare module 'babylonjs-viewer/configuration/interfaces/cameraConfiguration' {
|
|
export interface ICameraConfiguration {
|
|
export interface ICameraConfiguration {
|
|
position?: {
|
|
position?: {
|