/// /// /// declare module "babylonjs-loaders"{ export=BABYLON;} // Generated by dts-bundle v0.7.3 // Dependencies for this module: // ../../../../../Tools/Gulp/babylonjs // ../../../../../Tools/Gulp/babylonjs-gltf2interface // ../../../../../Tools/Gulp/babylonjs-loaders declare module 'babylonjs-viewer' { import { mapperManager } from 'babylonjs-viewer/configuration/mappers'; import { viewerGlobals } from 'babylonjs-viewer/configuration/globals'; import { viewerManager } from 'babylonjs-viewer/viewer/viewerManager'; import { DefaultViewer } from 'babylonjs-viewer/viewer/defaultViewer'; import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer'; import { telemetryManager } from 'babylonjs-viewer/managers/telemetryManager'; import { ModelLoader } from 'babylonjs-viewer/loader/modelLoader'; import { ViewerModel, ModelState } from 'babylonjs-viewer/model/viewerModel'; import { AnimationPlayMode, AnimationState } from 'babylonjs-viewer/model/modelAnimation'; import { ILoaderPlugin } from 'babylonjs-viewer/loader/plugins/loaderPlugin'; import { AbstractViewerNavbarButton } from 'babylonjs-viewer/templating/viewerTemplatePlugin'; import { registerCustomOptimizer } from 'babylonjs-viewer/optimizer/custom'; /** * BabylonJS Viewer * * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions. */ import * as BABYLON from 'babylonjs'; import 'babylonjs-loaders'; import 'pepjs'; import { InitTags } from 'babylonjs-viewer/initializer'; let disableInit: boolean; /** * Dispose all viewers currently registered */ function disposeAll(): void; const Version: string; export { BABYLON, Version, InitTags, DefaultViewer, AbstractViewer, viewerGlobals, telemetryManager, disableInit, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState, ILoaderPlugin, AbstractViewerNavbarButton, registerCustomOptimizer }; export * from 'babylonjs-viewer/configuration'; } declare module 'babylonjs-viewer/configuration/mappers' { import { ViewerConfiguration } from 'babylonjs-viewer/configuration/configuration'; /** * This is the mapper's interface. Implement this function to create your own mapper and register it at the mapper manager */ export interface IMapper { map(rawSource: any): ViewerConfiguration; } /** * The MapperManager manages the different implemented mappers. * It allows the user to register new mappers as well and use them to parse their own configuration data */ export class MapperManager { /** * The default mapper is the JSON mapper. */ static DefaultMapper: string; constructor(); /** * Get a specific configuration mapper. * * @param type the name of the mapper to load */ getMapper(type: string): IMapper; /** * Use this functio to register your own configuration mapper. * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration. * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper * @param mapper The implemented mapper */ registerMapper(type: string, mapper: IMapper): void; /** * Dispose the mapper manager and all of its mappers. */ dispose(): void; } /** * mapperManager is a singleton of the type MapperManager. * The mapperManager can be disposed directly with calling mapperManager.dispose() * or indirectly with using BabylonViewer.disposeAll() */ export let mapperManager: MapperManager; } declare module 'babylonjs-viewer/configuration/globals' { export class ViewerGlobals { disableInit: boolean; disableWebGL2Support: boolean; readonly version: string; } export let viewerGlobals: ViewerGlobals; } 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; /** * Will notify when a viewer was removed (disposed) */ onViewerRemovedObservable: Observable; 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; /** * 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/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 AbstractViewer 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: Element; /** * 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; /** * will notify when the engine was initialized */ readonly onEngineInitObservable: Observable; /** * Will notify when a new model was added to the scene. * Note that added does not neccessarily mean loaded! */ readonly onModelAddedObservable: Observable; /** * will notify after every model load */ readonly onModelLoadedObservable: Observable; /** * will notify when any model notify of progress */ readonly onModelLoadProgressObservable: Observable; /** * 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; /** * will notify when a new loader was initialized. * Used mainly to know when a model starts loading. */ readonly onLoaderInitObservable: Observable; /** * Observers registered here will be executed when the entire load process has finished. */ readonly onInitDoneObservable: Observable; /** * Functions added to this observable will be executed on each frame rendered. */ readonly onFrameRenderedObservable: Observable; /** * Observers registered here will be executed when VR more is entered. */ readonly onEnteringVRObservable: Observable; /** * Observers registered here will be executed when VR mode is exited. */ readonly onExitingVRObservable: Observable; 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: Element, 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; /** * 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 | 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} The viewer object will be returned after the object was loaded. */ protected _onTemplatesLoaded(): Promise; /** * 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; /** * Initialize the engine. Retruns a promise in case async calls are needed. * * @protected * @returns {Promise} * @memberof Viewer */ protected _initEngine(): Promise; /** * 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; protected _initTelemetryEvents(): void; /** * Injects all the spectre shader in the babylon shader store */ protected _injectCustomShaders(): void; } } declare module 'babylonjs-viewer/managers/telemetryManager' { import { Engine, Observable } from "babylonjs"; /** * The data structure of a telemetry event. */ export interface TelemetryData { event: string; session: string; date: Date; now: number; viewerId?: string; detail: any; } /** * Receives Telemetry events and raises events to the API */ export class TelemetryManager { onEventBroadcastedObservable: Observable; /** * Receives a telemetry event * @param event The name of the Telemetry event * @param details An additional value, or an object containing a list of property/value pairs */ readonly broadcast: (event: string, viewerId?: string | undefined, details?: any) => void; /** * Log a Telemetry event for errors raised on the WebGL context. * @param engine The Babylon engine with the WebGL context. */ flushWebGLErrors(engine: Engine, viewerId?: string): void; /** * Enable or disable telemetry events * @param enabled Boolan, true if events are enabled */ enable: boolean; /** * Returns the current session ID or creates one if it doesn't exixt * @return The current session ID */ readonly session: string; /** * Disposes the telemetry manager */ dispose(): void; } export const telemetryManager: TelemetryManager; } 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' { import { ISceneLoaderPlugin, ISceneLoaderPluginAsync, AnimationGroup, AbstractMesh, Observable, SceneLoaderProgressEvent, IParticleSystem, Skeleton, IDisposable, Nullable, Animation, Material } from "babylonjs"; import { IAsset } from "babylonjs-gltf2interface"; import { IModelConfiguration } from "babylonjs-viewer/configuration/interfaces/modelConfiguration"; import { IModelAnimation } from "babylonjs-viewer/model/modelAnimation"; import { ObservablesManager } from "babylonjs-viewer/managers/observablesManager"; import { ConfigurationContainer } from "babylonjs-viewer/configuration/configurationContainer"; /** * The current state of the model */ export enum ModelState { INIT = 0, LOADING = 1, LOADED = 2, ENTRY = 3, ENTRYDONE = 4, COMPLETE = 5, CANCELED = 6, ERROR = 7 } /** * The viewer model is a container for all assets representing a sngle loaded model. */ export class ViewerModel implements IDisposable { /** * The loader used to load this model. */ loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync; /** * This model's root mesh (the parent of all other meshes). * This mesh does not(!) exist in the meshes array. */ rootMesh: AbstractMesh; /** * ParticleSystems connected to this model */ particleSystems: Array; /** * Skeletons defined in this model */ skeletons: Array; /** * The current model animation. * On init, this will be undefined. */ currentAnimation: IModelAnimation; /** * Observers registered here will be executed when the model is done loading */ onLoadedObservable: Observable; /** * Observers registered here will be executed when the loader notified of a progress event */ onLoadProgressObservable: Observable; /** * Observers registered here will be executed when the loader notified of an error. */ onLoadErrorObservable: Observable<{ message: string; exception: any; }>; /** * Will be executed after the model finished loading and complete, including entry animation and lod */ onCompleteObservable: Observable; /** * Observers registered here will be executed every time the model is being configured. * This can be used to extend the model's configuration without extending the class itself */ onAfterConfigure: Observable; /** * The current model state (loaded, error, etc) */ state: ModelState; /** * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance. */ loadId: number; loadInfo: IAsset; constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined); shadowsRenderedAfterLoad: boolean; getViewerId(): string | undefined; /** * Set whether this model is enabled or not. */ enabled: boolean; loaderDone: boolean; /** * Add a mesh to this model. * Any mesh that has no parent will be provided with the root mesh as its new parent. * * @param mesh the new mesh to add * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually. */ addMesh(mesh: AbstractMesh, triggerLoaded?: boolean): Promise | undefined; /** * get the list of meshes (excluding the root mesh) */ readonly meshes: AbstractMesh[]; /** * (Re-)set the model's entire configuration * @param newConfiguration the new configuration to replace the new one */ configuration: IModelConfiguration; /** * Update the current configuration with new values. * Configuration will not be overwritten, but merged with the new configuration. * Priority is to the new configuration * @param newConfiguration the configuration to be merged into the current configuration; */ updateConfiguration(newConfiguration: Partial): void; /** * Add a new animation group to this model. * @param animationGroup the new animation group to be added */ addAnimationGroup(animationGroup: AnimationGroup): void; /** * Get the ModelAnimation array */ getAnimations(): Array; /** * Get the animations' names. Using the names you can play a specific animation. */ getAnimationNames(): Array; /** * Get an animation by the provided name. Used mainly when playing n animation. * @param name the name of the animation to find */ protected _getAnimationByName(name: string): Nullable; /** * Choose an initialized animation using its name and start playing it * @param name the name of the animation to play * @returns The model aniamtion to be played. */ playAnimation(name: string): IModelAnimation; setCurrentAnimationByName(name: string): IModelAnimation; /** * Apply a material configuration to a material * @param material Material to apply configuration to * @hidden */ _applyModelMaterialConfiguration(material: Material): void; /** * Begin @animations with the specified @easingFunction * @param animations The BABYLON Animations to begin * @param duration of transition, in seconds * @param easingFunction An easing function to apply * @param easingMode A easing mode to apply to the easingFunction * @param onAnimationEnd Call back trigger at the end of the animation. */ transitionTo(animations: Animation[], duration: number, easingFunction: any, easingMode: number | undefined, // BABYLON.EasingFunction.EASINGMODE_EASEINOUT, onAnimationEnd: () => void): void; /** * Stops and removes all animations that have been applied to the model */ stopAllAnimations(): void; /** * Will remove this model from the viewer (but NOT dispose it). */ remove(): void; /** * Dispose this model, including all of its associated assets. */ dispose(): void; } } declare module 'babylonjs-viewer/model/modelAnimation' { import { AnimationGroup, Vector3 } from 'babylonjs'; /** * Animation play mode enum - is the animation looping or playing once */ export const enum AnimationPlayMode { ONCE = 0, LOOP = 1 } /** * An enum representing the current state of an animation object */ export const enum AnimationState { INIT = 0, PLAYING = 1, PAUSED = 2, STOPPED = 3, ENDED = 4 } /** * The different type of easing functions available */ export const enum EasingFunction { Linear = 0, CircleEase = 1, BackEase = 2, BounceEase = 3, CubicEase = 4, ElasticEase = 5, ExponentialEase = 6, PowerEase = 7, QuadraticEase = 8, QuarticEase = 9, QuinticEase = 10, SineEase = 11 } /** * Defines a simple animation to be applied to a model (scale). */ export interface ModelAnimationConfiguration { /** * Time of animation, in seconds */ time: number; /** * Scale to apply */ scaling?: Vector3; /** * Easing function to apply * See SPECTRE.EasingFunction */ easingFunction?: number; /** * An Easing mode to apply to the easing function * See BABYLON.EasingFunction */ easingMode?: number; } /** * This interface can be implemented to define new types of ModelAnimation objects. */ export interface IModelAnimation { /** * Current animation state (playing, stopped etc') */ readonly state: AnimationState; /** * the name of the animation */ readonly name: string; /** * Get the max numbers of frame available in the animation group * * In correlation to an arry, this would be ".length" */ readonly frames: number; /** * Get the current frame playing right now. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data) * * In correlation to an array, this would be the current index */ readonly currentFrame: number; /** * Animation's FPS value */ readonly fps: number; /** * Get or set the animation's speed ration (Frame-to-fps) */ speedRatio: number; /** * Gets or sets the aimation's play mode. */ playMode: AnimationPlayMode; /** * Start the animation */ start(): any; /** * Stop the animation. * This will fail silently if the animation group is already stopped. */ stop(): any; /** * Pause the animation * This will fail silently if the animation is not currently playing */ pause(): any; /** * Reset this animation */ reset(): any; /** * Restart the animation */ restart(): any; /** * Go to a specific * @param frameNumber the frame number to go to */ goToFrame(frameNumber: number): any; /** * Dispose this animation */ dispose(): any; } /** * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's * native GroupAnimation class. */ export class GroupModelAnimation implements IModelAnimation { /** * Create a new GroupModelAnimation object using an AnimationGroup object * @param _animationGroup The aniamtion group to base the class on */ constructor(_animationGroup: AnimationGroup); /** * Get the animation's name */ readonly name: string; /** * Get the current animation's state */ readonly state: AnimationState; /** * Sets the speed ratio to use for all animations */ speedRatio: number; /** * Get the max numbers of frame available in the animation group * * In correlation to an arry, this would be ".length" */ readonly frames: number; /** * Get the current frame playing right now. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data) * * In correlation to an array, this would be the current index */ readonly currentFrame: number; /** * Get the FPS value of this animation */ readonly fps: number; /** * Set the play mode. * If the animation is played, it will continue playing at least once more, depending on the new play mode set. * If the animation is not set, the will be initialized and will wait for the user to start playing it. */ playMode: AnimationPlayMode; /** * Reset the animation group */ reset(): void; /** * Restart the animation group */ restart(): void; /** * * @param frameNumber Go to a specific frame in the animation */ goToFrame(frameNumber: number): void; /** * Start playing the animation. */ start(): void; /** * Pause the animation */ pause(): void; /** * Stop the animation. * This will fail silently if the animation group is already stopped. */ stop(): void; /** * Dispose this animation object. */ dispose(): void; } } declare module 'babylonjs-viewer/loader/plugins/loaderPlugin' { import { ViewerModel } from "babylonjs-viewer/model/viewerModel"; import { IGLTFLoaderExtension, IGLTFLoaderData } from "babylonjs-loaders"; import { AbstractMesh, ISceneLoaderPlugin, ISceneLoaderPluginAsync, SceneLoaderProgressEvent, BaseTexture, Material } from "babylonjs"; /** * This interface defines the structure of a loader plugin. * Any of those functions will be called if (!) the loader supports those callbacks. * Any loader supports onInit, onLoaded, onError and onProgress. */ export interface ILoaderPlugin { onInit?: (loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync, model: ViewerModel) => void; onLoaded?: (model: ViewerModel) => void; onError?: (message: string, exception?: any) => void; onProgress?: (progressEvent: SceneLoaderProgressEvent) => void; onExtensionLoaded?: (extension: IGLTFLoaderExtension) => void; onParsed?: (parsedData: IGLTFLoaderData) => void; onMeshLoaded?: (mesh: AbstractMesh) => void; onTextureLoaded?: (texture: BaseTexture) => void; onMaterialLoaded?: (material: Material) => void; onComplete?: () => void; } } declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' { import { EventCallback, Template } from "babylonjs-viewer/templating/templateManager"; export interface IViewerTemplatePlugin { readonly templateName: string; readonly eventsToAttach?: Array; interactionPredicate(event: EventCallback): boolean; onEvent?(event: EventCallback): void; addHTMLTemplate?(template: Template): void; } export abstract class AbstractViewerNavbarButton implements IViewerTemplatePlugin { readonly templateName: string; readonly eventsToAttach: Array; protected _prepend: boolean; protected _buttonName: string; protected _buttonClass: string; protected _htmlTemplate: string; constructor(buttonName: string, buttonClass?: string, htmlTemplate?: string); interactionPredicate(event: EventCallback): boolean; abstract onEvent(event: EventCallback): void; addHTMLTemplate(template: Template): void; protected _generateHTMLElement(template: Template): Element | DocumentFragment; } } 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): typeof extendedUpgrade; export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void; } declare module 'babylonjs-viewer/initializer' { /** * Will attach an init function the the DOMContentLoaded event. * The init function will be removed automatically after the event was triggered. */ export function initListeners(): void; /** * Select all HTML tags on the page that match the selector and initialize a viewer * * @param selector the selector to initialize the viewer on (default is 'babylon') */ export function InitTags(selector?: string): void; } declare module 'babylonjs-viewer/configuration' { export * from 'babylonjs-viewer/configuration/configuration'; export * from 'babylonjs-viewer/configuration/interfaces'; } declare module 'babylonjs-viewer/configuration/configuration' { import { EngineOptions } from 'babylonjs'; import { ICameraConfiguration, IDefaultRenderingPipelineConfiguration, IGroundConfiguration, ILightConfiguration, IModelConfiguration, IObserversConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, ISkyboxConfiguration, ITemplateConfiguration, IVRConfiguration } from 'babylonjs-viewer/configuration/interfaces'; import { IEnvironmentMapConfiguration } from 'babylonjs-viewer/configuration/interfaces/environmentMapConfiguration'; export function getConfigurationKey(key: string, configObject: any): any; export interface ViewerConfiguration { version?: string; extends?: string; pageUrl?: string; configuration?: string | { url?: string; payload?: any; mapper?: string; }; observers?: IObserversConfiguration; canvasElement?: string; model?: IModelConfiguration | string; scene?: ISceneConfiguration; optimizer?: ISceneOptimizerConfiguration | boolean; camera?: ICameraConfiguration; skybox?: boolean | ISkyboxConfiguration; ground?: boolean | IGroundConfiguration; lights?: { [name: string]: number | boolean | ILightConfiguration; }; engine?: { renderInBackground?: boolean; antialiasing?: boolean; disableResize?: boolean; engineOptions?: EngineOptions; adaptiveQuality?: boolean; hdEnabled?: boolean; }; templates?: { main: ITemplateConfiguration; [key: string]: ITemplateConfiguration; }; customShaders?: { shaders?: { [key: string]: string; }; includes?: { [key: string]: string; }; }; loaderPlugins?: { extendedMaterial?: boolean; msftLod?: boolean; telemetry?: boolean; minecraft?: boolean; [propName: string]: boolean | undefined; }; environmentMap?: IEnvironmentMapConfiguration; vr?: IVRConfiguration; lab?: { flashlight?: boolean | { exponent?: number; angle?: number; intensity?: number; diffuse?: { r: number; g: number; b: number; }; specular?: { r: number; g: number; b: number; }; }; hideLoadingDelay?: number; /** Deprecated */ assetsRootURL?: string; environmentMainColor?: { r: number; g: number; b: number; }; /** Deprecated */ environmentMap?: { /** * 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; }; defaultRenderingPipelines?: boolean | IDefaultRenderingPipelineConfiguration; globalLightRotation?: number; }; } } declare module 'babylonjs-viewer/configuration/configurationContainer' { import { ViewerConfiguration } from 'babylonjs-viewer/configuration/configuration'; import { Color3, Scene } from 'babylonjs'; export class ConfigurationContainer { configuration: ViewerConfiguration; viewerId: string; mainColor: Color3; reflectionColor: Color3; scene?: Scene; } } 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); /** * 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. */ loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise; /** * Dispose the configuration loader. This will cancel file requests, if active. */ dispose(): void; } } declare module 'babylonjs-viewer/managers/observablesManager' { import { Engine, ISceneLoaderPlugin, ISceneLoaderPluginAsync, Observable, Scene, SceneLoaderProgressEvent } from 'babylonjs'; import { ViewerModel } from 'babylonjs-viewer/model/viewerModel'; export class ObservablesManager { /** * Will notify when the scene was initialized */ onSceneInitObservable: Observable; /** * will notify when the engine was initialized */ onEngineInitObservable: Observable; /** * Will notify when a new model was added to the scene. * Note that added does not neccessarily mean loaded! */ onModelAddedObservable: Observable; /** * will notify after every model load */ onModelLoadedObservable: Observable; /** * will notify when any model notify of progress */ onModelLoadProgressObservable: Observable; /** * will notify when any model load failed. */ onModelLoadErrorObservable: Observable<{ message: string; exception: any; }>; /** * Will notify when a model was removed from the scene; */ onModelRemovedObservable: Observable; /** * will notify when a new loader was initialized. * Used mainly to know when a model starts loading. */ onLoaderInitObservable: Observable; /** * Observers registered here will be executed when the entire load process has finished. */ onViewerInitDoneObservable: Observable; /** * Will notify when the viewer init started (after configuration was loaded) */ onViewerInitStartedObservable: Observable; /** * Functions added to this observable will be executed on each frame rendered. */ onFrameRenderedObservable: Observable; /** * Will notify when VR mode is entered. */ onEnteringVRObservable: Observable; /** * Will notify when VR mode is exited. */ onExitingVRObservable: Observable; constructor(); dispose(): void; } } declare module 'babylonjs-viewer/managers/sceneManager' { import { Scene, ArcRotateCamera, Engine, Light, SceneOptimizer, EnvironmentHelper, Color3, Observable, DefaultRenderingPipeline, Nullable, VRExperienceHelper, IShadowLight } from 'babylonjs'; import { ILightConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, ICameraConfiguration, ISkyboxConfiguration, ViewerConfiguration, IGroundConfiguration, IModelConfiguration, IVRConfiguration } from 'babylonjs-viewer/configuration'; import { ViewerModel } from 'babylonjs-viewer/model/viewerModel'; import { ViewerLabs } from 'babylonjs-viewer/labs/viewerLabs'; import { ObservablesManager } from 'babylonjs-viewer/managers/observablesManager'; import { ConfigurationContainer } from 'babylonjs-viewer/configuration/configurationContainer'; import { IEnvironmentMapConfiguration } from 'babylonjs-viewer/configuration/interfaces/environmentMapConfiguration'; /** * 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, ArcRotateCamera, Scene, etc') * T - the configuration type */ export interface IPostConfigurationCallback { newConfiguration: CONF; sceneManager: SceneManager; object: OBJ; model?: ViewerModel; } export class SceneManager { /** * Will notify when the scene was initialized */ onSceneInitObservable: Observable; /** * Will notify after the scene was configured. Can be used to further configure the scene */ onSceneConfiguredObservable: Observable>; /** * Will notify after the scene optimized was configured. Can be used to further configure the scene optimizer */ onSceneOptimizerConfiguredObservable: Observable>; /** * Will notify after the camera was configured. Can be used to further configure the camera */ onCameraConfiguredObservable: Observable>; /** * Will notify after the lights were configured. Can be used to further configure lights */ onLightsConfiguredObservable: Observable, { [name: string]: ILightConfiguration | boolean | number; }>>; /** * Will notify after the model(s) were configured. Can be used to further configure models */ onModelsConfiguredObservable: Observable, IModelConfiguration>>; /** * Will notify after the envirnoment was configured. Can be used to further configure the environment */ onEnvironmentConfiguredObservable: Observable>; /** * Will notify after the model(s) were configured. Can be used to further configure models */ onVRConfiguredObservable: Observable>; /** * The Babylon Scene of this viewer */ scene: Scene; /** * The camera used in this viewer */ camera: ArcRotateCamera; /** * Babylon's scene optimizer */ sceneOptimizer: SceneOptimizer; /** * Models displayed in this viewer. */ models: Array; /** * Babylon's environment helper of this viewer */ environmentHelper?: EnvironmentHelper; protected _defaultHighpTextureType: number; protected _shadowGeneratorBias: number; protected _defaultPipelineTextureType: number; /** * The maximum number of shadows supported by the curent viewer */ protected _maxShadows: number; /** * The labs variable consists of objects that will have their API change. * Please be careful when using labs in production. */ labs: ViewerLabs; readonly defaultRenderingPipeline: Nullable; protected _vrHelper?: VRExperienceHelper; readonly vrHelper: VRExperienceHelper | undefined; constructor(_engine: Engine, _configurationContainer: ConfigurationContainer, _observablesManager?: ObservablesManager | undefined); /** * Returns a boolean representing HDR support */ readonly isHdrSupported: boolean; /** * Return the main color defined in the configuration. */ readonly mainColor: Color3; readonly reflectionColor: Color3; animationBlendingEnabled: boolean; readonly observablesManager: ObservablesManager | undefined; /** * Should shadows be rendered every frame, or only once and stop. * This can be used to optimize a scene. * * Not that the shadows will NOT disapear but will remain in place. * @param process if true shadows will be updated once every frame. if false they will stop being updated. */ processShadows: boolean; groundEnabled: boolean; /** * sets wether the reflection is disabled. */ groundMirrorEnabled: boolean; defaultRenderingPipelineEnabled: boolean; /** * Sets the engine flags to unlock all babylon features. * Can also be configured using the scene.flags configuration object */ unlockBabylonFeatures(): void; /** * initialize the scene. Calling this function again will dispose the old scene, if exists. */ initScene(sceneConfiguration?: ISceneConfiguration, optimizerConfiguration?: boolean | ISceneOptimizerConfiguration): Promise; clearScene(clearModels?: boolean, clearLights?: boolean): void; /** * This will update the scene's configuration, including camera, lights, environment. * @param newConfiguration the delta that should be configured. This includes only the changes * @param globalConfiguration The global configuration object, after the new configuration was merged into it */ updateConfiguration(newConfiguration: Partial): void; bloomEnabled: boolean; fxaaEnabled: boolean; /** * internally configure the scene using the provided configuration. * The scene will not be recreated, but just updated. * @param sceneConfig the (new) scene configuration */ protected _configureScene(sceneConfig: ISceneConfiguration): void; /** * Configure the scene optimizer. * The existing scene optimizer will be disposed and a new one will be created. * @param optimizerConfig the (new) optimizer configuration */ protected _configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void; /** * configure all models using the configuration. * @param modelConfiguration the configuration to use to reconfigure the models */ protected _configureVR(vrConfig: IVRConfiguration): void; protected _configureEnvironmentMap(environmentMapConfiguration: IEnvironmentMapConfiguration): any; /** * (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured. * @param cameraConfig the new camera configuration * @param model optionally use the model to configure the camera. */ protected _configureCamera(cameraConfig?: ICameraConfiguration): void; protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void; /** * configure the lights. * * @param lightsConfiguration the (new) light(s) configuration * @param model optionally use the model to configure the camera. */ protected _configureLights(lightsConfiguration?: { [name: string]: ILightConfiguration | boolean | number; }): void; /** * Gets the shadow map blur kernel according to the light configuration. * @param light The light used to generate the shadows * @param bufferSize The size of the shadow map * @return the kernel blur size */ getBlurKernel(light: IShadowLight, bufferSize: number): number; /** * Alters render settings to reduce features based on hardware feature limitations * @param enableHDR Allows the viewer to run in HDR mode. */ protected _handleHardwareLimitations(enableHDR?: boolean): void; /** * Dispoe the entire viewer including the scene and the engine */ dispose(): void; } } declare module 'babylonjs-viewer/templating/templateManager' { import { Observable } from 'babylonjs'; import { EventManager } from 'babylonjs-viewer/templating/eventManager'; import { ITemplateConfiguration } from 'babylonjs-viewer/configuration/interfaces'; /** * The object sent when an event is triggered */ export interface EventCallback { event: Event; template: Template; selector: string; payload?: any; } /** * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML. * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer. */ export class TemplateManager { containerElement: Element; /** * Will be triggered when any template is initialized */ onTemplateInit: Observable