|
@@ -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' {
|
|
@@ -1607,6 +1642,26 @@ 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/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';
|
|
@@ -1626,28 +1681,7 @@ declare module 'babylonjs-viewer/configuration/interfaces' {
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/configuration/interfaces/environmentMapConfiguration' {
|
|
declare module 'babylonjs-viewer/configuration/interfaces/environmentMapConfiguration' {
|
|
- export interface IEnvironmentMapConfiguration {
|
|
|
|
- /**
|
|
|
|
- * Environment map texture path in relative to the asset folder.
|
|
|
|
- */
|
|
|
|
- texture: string;
|
|
|
|
- /**
|
|
|
|
- * Default rotation to apply to the environment map.
|
|
|
|
- */
|
|
|
|
- rotationY: number;
|
|
|
|
- /**
|
|
|
|
- * Tint level of the main color on the environment map.
|
|
|
|
- */
|
|
|
|
- tintLevel: number;
|
|
|
|
- /**
|
|
|
|
- * The environment's main color.
|
|
|
|
- */
|
|
|
|
- mainColor?: {
|
|
|
|
- r?: number;
|
|
|
|
- g?: number;
|
|
|
|
- b?: number;
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
declare module 'babylonjs-viewer/templating/eventManager' {
|
|
declare module 'babylonjs-viewer/templating/eventManager' {
|
|
@@ -1765,6 +1799,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?: {
|