babylon.viewer.module.d.ts 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. /// <reference path="./babylon.d.ts"/>// Generated by dts-bundle v0.7.3
  2. // Dependencies for this module:
  3. // ../../Tools/Gulp/babylonjs
  4. declare module 'babylonjs-viewer' {
  5. import { mapperManager } from 'babylonjs-viewer/configuration/mappers';
  6. import { viewerManager } from 'babylonjs-viewer/viewer/viewerManager';
  7. import { DefaultViewer } from 'babylonjs-viewer/viewer/defaultViewer';
  8. import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
  9. import { ModelLoader } from 'babylonjs-viewer/model/modelLoader';
  10. import { ViewerModel, ModelState } from 'babylonjs-viewer/model/viewerModel';
  11. import { AnimationPlayMode, AnimationState } from 'babylonjs-viewer/model/modelAnimation';
  12. import 'babylonjs-loaders';
  13. import 'pep';
  14. import { InitTags } from 'babylonjs-viewer/initializer';
  15. export let disableInit: boolean;
  16. /**
  17. * Dispose all viewers currently registered
  18. */
  19. function disposeAll(): void;
  20. export { InitTags, DefaultViewer, AbstractViewer, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState };
  21. }
  22. declare module 'babylonjs-viewer/configuration/mappers' {
  23. import { ViewerConfiguration } from 'babylonjs-viewer/configuration/configuration';
  24. /**
  25. * This is the mapper's interface. Implement this function to create your own mapper and register it at the mapper manager
  26. */
  27. export interface IMapper {
  28. map(rawSource: any): ViewerConfiguration;
  29. }
  30. /**
  31. * The MapperManager manages the different implemented mappers.
  32. * It allows the user to register new mappers as well and use them to parse their own configuration data
  33. */
  34. export class MapperManager {
  35. /**
  36. * The default mapper is the JSON mapper.
  37. */
  38. static DefaultMapper: string;
  39. constructor();
  40. /**
  41. * Get a specific configuration mapper.
  42. *
  43. * @param type the name of the mapper to load
  44. */
  45. getMapper(type: string): IMapper;
  46. /**
  47. * Use this functio to register your own configuration mapper.
  48. * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.
  49. * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper
  50. * @param mapper The implemented mapper
  51. */
  52. registerMapper(type: string, mapper: IMapper): void;
  53. /**
  54. * Dispose the mapper manager and all of its mappers.
  55. */
  56. dispose(): void;
  57. }
  58. /**
  59. * mapperManager is a singleton of the type MapperManager.
  60. * The mapperManager can be disposed directly with calling mapperManager.dispose()
  61. * or indirectly with using BabylonViewer.disposeAll()
  62. */
  63. export let mapperManager: MapperManager;
  64. }
  65. declare module 'babylonjs-viewer/viewer/viewerManager' {
  66. import { Observable } from 'babylonjs';
  67. import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
  68. /**
  69. * The viewer manager is the container for all viewers currently registered on this page.
  70. * It is possible to have more than one viewer on a single page.
  71. */
  72. export class ViewerManager {
  73. /**
  74. * A callback that will be triggered when a new viewer was added
  75. */
  76. onViewerAdded: (viewer: AbstractViewer) => void;
  77. /**
  78. * Will notify when a new viewer was added
  79. */
  80. onViewerAddedObservable: Observable<AbstractViewer>;
  81. /**
  82. * Will notify when a viewer was removed (disposed)
  83. */
  84. onViewerRemovedObservable: Observable<string>;
  85. constructor();
  86. /**
  87. * Adding a new viewer to the viewer manager and start tracking it.
  88. * @param viewer the viewer to add
  89. */
  90. addViewer(viewer: AbstractViewer): void;
  91. /**
  92. * remove a viewer from the viewer manager
  93. * @param viewer the viewer to remove
  94. */
  95. removeViewer(viewer: AbstractViewer): void;
  96. /**
  97. * 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)
  98. * @param id the id of the HTMl element (or the viewer's, if none provided)
  99. */
  100. getViewerById(id: string): AbstractViewer;
  101. /**
  102. * Get a viewer using a container element
  103. * @param element the HTML element to search viewers associated with
  104. */
  105. getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
  106. /**
  107. * Get a promise that will fullfil when this viewer was initialized.
  108. * Since viewer initialization and template injection is asynchronous, using the promise will guaranty that
  109. * you will get the viewer after everything was already configured.
  110. * @param id the viewer id to find
  111. */
  112. getViewerPromiseById(id: string): Promise<AbstractViewer>;
  113. /**
  114. * dispose the manager and all of its associated viewers
  115. */
  116. dispose(): void;
  117. }
  118. export let viewerManager: ViewerManager;
  119. }
  120. declare module 'babylonjs-viewer/viewer/defaultViewer' {
  121. import { ViewerConfiguration, ILightConfiguration } from 'babylonjs-viewer/configuration/configuration';
  122. import { Template } from 'babylonjs-viewer/templateManager';
  123. import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
  124. import { Scene } from 'babylonjs';
  125. import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
  126. /**
  127. * The Default viewer is the default implementation of the AbstractViewer.
  128. * It uses the templating system to render a new canvas and controls.
  129. */
  130. export class DefaultViewer extends AbstractViewer {
  131. containerElement: HTMLElement;
  132. /**
  133. * Create a new default viewer
  134. * @param containerElement the element in which the templates will be rendered
  135. * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
  136. */
  137. constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
  138. /**
  139. * Overriding the AbstractViewer's _initScene fcuntion
  140. */
  141. protected _initScene(): Promise<Scene>;
  142. /**
  143. * This will be executed when the templates initialize.
  144. */
  145. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  146. /**
  147. * Preparing the container element to present the viewer
  148. */
  149. protected _prepareContainerElement(): void;
  150. /**
  151. * This function will configure the templates and update them after a model was loaded
  152. * It is mainly responsible to changing the title and subtitle etc'.
  153. * @param model the model to be used to configure the templates by
  154. */
  155. protected _configureTemplate(model: ViewerModel): void;
  156. /**
  157. * This will load a new model to the default viewer
  158. * overriding the AbstractViewer's loadModel.
  159. * The scene will automatically be cleared of the old models, if exist.
  160. * @param model the configuration object (or URL) to load.
  161. */
  162. loadModel(model?: any): Promise<ViewerModel>;
  163. /**
  164. * Show the overlay and the defined sub-screen.
  165. * Mainly used for help and errors
  166. * @param subScreen the name of the subScreen. Those can be defined in the configuration object
  167. */
  168. showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
  169. /**
  170. * Hide the overlay screen.
  171. */
  172. hideOverlayScreen(): Promise<string> | Promise<Template>;
  173. /**
  174. * Show the loading screen.
  175. * The loading screen can be configured using the configuration object
  176. */
  177. showLoadingScreen(): Promise<string> | Promise<Template>;
  178. /**
  179. * Hide the loading screen
  180. */
  181. hideLoadingScreen(): Promise<string> | Promise<Template>;
  182. /**
  183. * An extension of the light configuration of the abstract viewer.
  184. * @param lightsConfiguration the light configuration to use
  185. * @param model the model that will be used to configure the lights (if the lights are model-dependant)
  186. */
  187. protected _configureLights(lightsConfiguration: {
  188. [name: string]: boolean | ILightConfiguration;
  189. } | undefined, model: ViewerModel): void;
  190. }
  191. }
  192. declare module 'babylonjs-viewer/viewer/viewer' {
  193. import { TemplateManager } from 'babylonjs-viewer/templateManager';
  194. import { ConfigurationLoader } from 'babylonjs-viewer/configuration/loader';
  195. import { EnvironmentHelper, SceneOptimizer, Observable, Engine, Scene, ArcRotateCamera, SceneLoaderProgressEvent, ISceneLoaderPlugin, ISceneLoaderPluginAsync } from 'babylonjs';
  196. import { ViewerConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, IObserversConfiguration, IModelConfiguration, ISkyboxConfiguration, IGroundConfiguration, ILightConfiguration, ICameraConfiguration } from 'babylonjs-viewer/configuration/configuration';
  197. import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
  198. import { ModelLoader } from 'babylonjs-viewer/model/modelLoader';
  199. /**
  200. * The AbstractViewr is the center of Babylon's viewer.
  201. * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
  202. */
  203. export abstract class AbstractViewer {
  204. containerElement: HTMLElement;
  205. /**
  206. * The corresponsing template manager of this viewer.
  207. */
  208. templateManager: TemplateManager;
  209. /**
  210. * Babylon Engine corresponding with this viewer
  211. */
  212. engine: Engine;
  213. /**
  214. * The Babylon Scene of this viewer
  215. */
  216. scene: Scene;
  217. /**
  218. * The camera used in this viewer
  219. */
  220. camera: ArcRotateCamera;
  221. /**
  222. * Babylon's scene optimizer
  223. */
  224. sceneOptimizer: SceneOptimizer;
  225. /**
  226. * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
  227. */
  228. readonly baseId: string;
  229. /**
  230. * Models displayed in this viewer.
  231. */
  232. models: Array<ViewerModel>;
  233. /**
  234. * The last loader used to load a model.
  235. */
  236. lastUsedLoader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  237. /**
  238. * The ModelLoader instance connected with this viewer.
  239. */
  240. modelLoader: ModelLoader;
  241. /**
  242. * the viewer configuration object
  243. */
  244. protected _configuration: ViewerConfiguration;
  245. /**
  246. * Babylon's environment helper of this viewer
  247. */
  248. environmentHelper: EnvironmentHelper;
  249. protected _defaultHighpTextureType: number;
  250. protected _shadowGeneratorBias: number;
  251. protected _defaultPipelineTextureType: number;
  252. /**
  253. * The maximum number of shadows supported by the curent viewer
  254. */
  255. protected _maxShadows: number;
  256. /**
  257. * is this viewer disposed?
  258. */
  259. protected _isDisposed: boolean;
  260. /**
  261. * Returns a boolean representing HDR support
  262. */
  263. readonly isHdrSupported: boolean;
  264. /**
  265. * Will notify when the scene was initialized
  266. */
  267. onSceneInitObservable: Observable<Scene>;
  268. /**
  269. * will notify when the engine was initialized
  270. */
  271. onEngineInitObservable: Observable<Engine>;
  272. /**
  273. * will notify after every model load
  274. */
  275. onModelLoadedObservable: Observable<ViewerModel>;
  276. /**
  277. * will notify when any model notify of progress
  278. */
  279. onModelLoadProgressObservable: Observable<SceneLoaderProgressEvent>;
  280. /**
  281. * will notify when any model load failed.
  282. */
  283. onModelLoadErrorObservable: Observable<{
  284. message: string;
  285. exception: any;
  286. }>;
  287. /**
  288. * will notify when a new loader was initialized.
  289. * Used mainly to know when a model starts loading.
  290. */
  291. onLoaderInitObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
  292. /**
  293. * Observers registered here will be executed when the entire load process has finished.
  294. */
  295. onInitDoneObservable: Observable<AbstractViewer>;
  296. /**
  297. * The canvas associated with this viewer
  298. */
  299. protected _canvas: HTMLCanvasElement;
  300. /**
  301. * The (single) canvas of this viewer
  302. */
  303. readonly canvas: HTMLCanvasElement;
  304. /**
  305. * registered onBeforeRender functions.
  306. * This functions are also registered at the native scene. The reference can be used to unregister them.
  307. */
  308. protected _registeredOnBeforeRenderFunctions: Array<() => void>;
  309. /**
  310. * The configuration loader of this viewer
  311. */
  312. protected _configurationLoader: ConfigurationLoader;
  313. constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
  314. /**
  315. * get the baseId of this viewer
  316. */
  317. getBaseId(): string;
  318. /**
  319. * Do we have a canvas to render on, and is it a part of the scene
  320. */
  321. isCanvasInDOM(): boolean;
  322. /**
  323. * The resize function that will be registered with the window object
  324. */
  325. protected _resize: () => void;
  326. /**
  327. * render loop that will be executed by the engine
  328. */
  329. protected _render: () => void;
  330. /**
  331. * Update the current viewer configuration with new values.
  332. * Only provided information will be updated, old configuration values will be kept.
  333. * If this.configuration was manually changed, you can trigger this function with no parameters,
  334. * and the entire configuration will be updated.
  335. * @param newConfiguration
  336. */
  337. updateConfiguration(newConfiguration?: Partial<ViewerConfiguration>): void;
  338. protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): Promise<Scene> | undefined;
  339. /**
  340. * internally configure the scene using the provided configuration.
  341. * The scene will not be recreated, but just updated.
  342. * @param sceneConfig the (new) scene configuration
  343. */
  344. protected _configureScene(sceneConfig: ISceneConfiguration): void;
  345. /**
  346. * Configure the scene optimizer.
  347. * The existing scene optimizer will be disposed and a new one will be created.
  348. * @param optimizerConfig the (new) optimizer configuration
  349. */
  350. protected _configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
  351. /**
  352. * this is used to register native functions using the configuration object.
  353. * This will configure the observers.
  354. * @param observersConfiguration observers configuration
  355. */
  356. protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
  357. /**
  358. * (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
  359. * @param cameraConfig the new camera configuration
  360. * @param model optionally use the model to configure the camera.
  361. */
  362. protected _configureCamera(cameraConfig: ICameraConfiguration, model?: ViewerModel): void;
  363. /**
  364. * configure the lights.
  365. *
  366. * @param lightsConfiguration the (new) light(s) configuration
  367. * @param model optionally use the model to configure the camera.
  368. */
  369. protected _configureLights(lightsConfiguration?: {
  370. [name: string]: ILightConfiguration | boolean;
  371. }, model?: ViewerModel): void;
  372. /**
  373. * configure all models using the configuration.
  374. * @param modelConfiguration the configuration to use to reconfigure the models
  375. */
  376. protected _configureModel(modelConfiguration: Partial<IModelConfiguration>): void;
  377. /**
  378. * Dispoe the entire viewer including the scene and the engine
  379. */
  380. dispose(): void;
  381. /**
  382. * This will prepare the container element for the viewer
  383. */
  384. protected abstract _prepareContainerElement(): any;
  385. /**
  386. * This function will execute when the HTML templates finished initializing.
  387. * It should initialize the engine and continue execution.
  388. *
  389. * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
  390. */
  391. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  392. /**
  393. * Initialize the engine. Retruns a promise in case async calls are needed.
  394. *
  395. * @protected
  396. * @returns {Promise<Engine>}
  397. * @memberof Viewer
  398. */
  399. protected _initEngine(): Promise<Engine>;
  400. /**
  401. * initialize the scene. Calling thsi function again will dispose the old scene, if exists.
  402. */
  403. protected _initScene(): Promise<Scene>;
  404. /**
  405. * Initialize a model loading. The returns object (a ViewerModel object) will be loaded in the background.
  406. * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
  407. *
  408. * @param modelConfig model configuration to use when loading the model.
  409. * @param clearScene should the scene be cleared before loading this model
  410. * @returns a ViewerModel object that is not yet fully loaded.
  411. */
  412. initModel(modelConfig: IModelConfiguration, clearScene?: boolean): ViewerModel;
  413. /**
  414. * load a model using the provided configuration
  415. *
  416. * @param modelConfig the model configuration or URL to load.
  417. * @param clearScene Should the scene be cleared before loading the model
  418. * @returns a Promise the fulfills when the model finished loading successfully.
  419. */
  420. loadModel(modelConfig?: any, clearScene?: boolean): Promise<ViewerModel>;
  421. /**
  422. * initialize the environment for a specific model.
  423. * Per default it will use the viewer'S configuration.
  424. * @param model the model to use to configure the environment.
  425. * @returns a Promise that will resolve when the configuration is done.
  426. */
  427. protected _initEnvironment(model?: ViewerModel): Promise<Scene>;
  428. /**
  429. * Alters render settings to reduce features based on hardware feature limitations
  430. * @param enableHDR Allows the viewer to run in HDR mode.
  431. */
  432. protected _handleHardwareLimitations(enableHDR?: boolean): void;
  433. /**
  434. * Injects all the spectre shader in the babylon shader store
  435. */
  436. protected _injectCustomShaders(): void;
  437. /**
  438. * This will extend an object with configuration values.
  439. * What it practically does it take the keys from the configuration and set them on the object.
  440. * I the configuration is a tree, it will traverse into the tree.
  441. * @param object the object to extend
  442. * @param config the configuration object that will extend the object
  443. */
  444. protected _extendClassWithConfig(object: any, config: any): void;
  445. }
  446. }
  447. declare module 'babylonjs-viewer/model/modelLoader' {
  448. import { AbstractViewer } from "babylonjs-viewer/";
  449. import { IModelConfiguration } from "babylonjs-viewer/configuration/configuration";
  450. import { ViewerModel } from "babylonjs-viewer/model/viewerModel";
  451. /**
  452. * An instance of the class is in charge of loading the model correctly.
  453. * This class will continously be expended with tasks required from the specific loaders Babylon has.
  454. *
  455. * A Model loader is unique per (Abstract)Viewer. It is being generated by the viewer
  456. */
  457. export class ModelLoader {
  458. /**
  459. * Create a new Model loader
  460. * @param _viewer the viewer using this model loader
  461. */
  462. constructor(_viewer: AbstractViewer);
  463. /**
  464. * Load a model using predefined configuration
  465. * @param modelConfiguration the modelConfiguration to use to load the model
  466. */
  467. load(modelConfiguration: IModelConfiguration): ViewerModel;
  468. cancelLoad(model: ViewerModel): void;
  469. /**
  470. * dispose the model loader.
  471. * If loaders are registered and are in the middle of loading, they will be disposed and the request(s) will be cancelled.
  472. */
  473. dispose(): void;
  474. }
  475. }
  476. declare module 'babylonjs-viewer/model/viewerModel' {
  477. import { ISceneLoaderPlugin, ISceneLoaderPluginAsync, AnimationGroup, AbstractMesh, Observable, SceneLoaderProgressEvent, ParticleSystem, Skeleton, IDisposable, Nullable } from "babylonjs";
  478. import { IModelConfiguration } from "babylonjs-viewer/configuration/configuration";
  479. import { IModelAnimation } from "babylonjs-viewer/model/modelAnimation";
  480. import { AbstractViewer } from "babylonjs-viewer/";
  481. export enum ModelState {
  482. INIT = 0,
  483. LOADING = 1,
  484. LOADED = 2,
  485. CANCELED = 3,
  486. ERROR = 4,
  487. }
  488. /**
  489. * The viewer model is a container for all assets representing a sngle loaded model.
  490. */
  491. export class ViewerModel implements IDisposable {
  492. protected _viewer: AbstractViewer;
  493. /**
  494. * The loader used to load this model.
  495. */
  496. loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  497. /**
  498. * the list of meshes that are a part of this model
  499. */
  500. meshes: Array<AbstractMesh>;
  501. /**
  502. * This model's root mesh (the parent of all other meshes).
  503. * This mesh also exist in the meshes array.
  504. */
  505. rootMesh: AbstractMesh;
  506. /**
  507. * ParticleSystems connected to this model
  508. */
  509. particleSystems: Array<ParticleSystem>;
  510. /**
  511. * Skeletons defined in this model
  512. */
  513. skeletons: Array<Skeleton>;
  514. /**
  515. * The current model animation.
  516. * On init, this will be undefined.
  517. */
  518. currentAnimation: IModelAnimation;
  519. /**
  520. * Observers registered here will be executed when the model is done loading
  521. */
  522. onLoadedObservable: Observable<ViewerModel>;
  523. /**
  524. * Observers registered here will be executed when the loader notified of a progress event
  525. */
  526. onLoadProgressObservable: Observable<SceneLoaderProgressEvent>;
  527. /**
  528. * Observers registered here will be executed when the loader notified of an error.
  529. */
  530. onLoadErrorObservable: Observable<{
  531. message: string;
  532. exception: any;
  533. }>;
  534. /**
  535. * Observers registered here will be executed every time the model is being configured.
  536. * This can be used to extend the model's configuration without extending the class itself
  537. */
  538. onAfterConfigure: Observable<ViewerModel>;
  539. /**
  540. * The current model state (loaded, error, etc)
  541. */
  542. state: ModelState;
  543. /**
  544. * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
  545. */
  546. loadId: number;
  547. constructor(_viewer: AbstractViewer, modelConfiguration: IModelConfiguration);
  548. /**
  549. * (Re-)set the model's entire configuration
  550. * @param newConfiguration the new configuration to replace the new one
  551. */
  552. configuration: IModelConfiguration;
  553. /**
  554. * Update the current configuration with new values.
  555. * Configuration will not be overwritten, but merged with the new configuration.
  556. * Priority is to the new configuration
  557. * @param newConfiguration the configuration to be merged into the current configuration;
  558. */
  559. updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
  560. initAnimations(): void;
  561. /**
  562. * Add a new animation group to this model.
  563. * @param animationGroup the new animation group to be added
  564. */
  565. addAnimationGroup(animationGroup: AnimationGroup): void;
  566. /**
  567. * Get the ModelAnimation array
  568. */
  569. getAnimations(): Array<IModelAnimation>;
  570. /**
  571. * Get the animations' names. Using the names you can play a specific animation.
  572. */
  573. getAnimationNames(): Array<string>;
  574. /**
  575. * Get an animation by the provided name. Used mainly when playing n animation.
  576. * @param name the name of the animation to find
  577. */
  578. protected _getAnimationByName(name: string): Nullable<IModelAnimation>;
  579. /**
  580. * Choose an initialized animation using its name and start playing it
  581. * @param name the name of the animation to play
  582. * @returns The model aniamtion to be played.
  583. */
  584. playAnimation(name: string): IModelAnimation;
  585. /**
  586. * Dispose this model, including all of its associated assets.
  587. */
  588. dispose(): void;
  589. }
  590. }
  591. declare module 'babylonjs-viewer/model/modelAnimation' {
  592. import { AnimationGroup } from "babylonjs";
  593. /**
  594. * Animation play mode enum - is the animation looping or playing once
  595. */
  596. export enum AnimationPlayMode {
  597. ONCE = 0,
  598. LOOP = 1,
  599. }
  600. /**
  601. * An enum representing the current state of an animation object
  602. */
  603. export enum AnimationState {
  604. INIT = 0,
  605. PLAYING = 1,
  606. PAUSED = 2,
  607. STOPPED = 3,
  608. ENDED = 4,
  609. }
  610. /**
  611. * This interface can be implemented to define new types of ModelAnimation objects.
  612. */
  613. export interface IModelAnimation {
  614. /**
  615. * Current animation state (playing, stopped etc')
  616. */
  617. readonly state: AnimationState;
  618. /**
  619. * the name of the animation
  620. */
  621. readonly name: string;
  622. /**
  623. * Get the max numbers of frame available in the animation group
  624. *
  625. * In correlation to an arry, this would be ".length"
  626. */
  627. readonly frames: number;
  628. /**
  629. * Get the current frame playing right now.
  630. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
  631. *
  632. * In correlation to an array, this would be the current index
  633. */
  634. readonly currentFrame: number;
  635. /**
  636. * Animation's FPS value
  637. */
  638. readonly fps: number;
  639. /**
  640. * Get or set the animation's speed ration (Frame-to-fps)
  641. */
  642. speedRatio: number;
  643. /**
  644. * Gets or sets the aimation's play mode.
  645. */
  646. playMode: AnimationPlayMode;
  647. /**
  648. * Start the animation
  649. */
  650. start(): any;
  651. /**
  652. * Stop the animation.
  653. * This will fail silently if the animation group is already stopped.
  654. */
  655. stop(): any;
  656. /**
  657. * Pause the animation
  658. * This will fail silently if the animation is not currently playing
  659. */
  660. pause(): any;
  661. /**
  662. * Reset this animation
  663. */
  664. reset(): any;
  665. /**
  666. * Restart the animation
  667. */
  668. restart(): any;
  669. /**
  670. * Go to a specific
  671. * @param frameNumber the frame number to go to
  672. */
  673. goToFrame(frameNumber: number): any;
  674. /**
  675. * Dispose this animation
  676. */
  677. dispose(): any;
  678. }
  679. /**
  680. * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
  681. * native GroupAnimation class.
  682. */
  683. export class GroupModelAnimation implements IModelAnimation {
  684. /**
  685. * Create a new GroupModelAnimation object using an AnimationGroup object
  686. * @param _animationGroup The aniamtion group to base the class on
  687. */
  688. constructor(_animationGroup: AnimationGroup);
  689. /**
  690. * Get the animation's name
  691. */
  692. readonly name: string;
  693. /**
  694. * Get the current animation's state
  695. */
  696. readonly state: AnimationState;
  697. /**
  698. * Sets the speed ratio to use for all animations
  699. */
  700. speedRatio: number;
  701. /**
  702. * Get the max numbers of frame available in the animation group
  703. *
  704. * In correlation to an arry, this would be ".length"
  705. */
  706. readonly frames: number;
  707. /**
  708. * Get the current frame playing right now.
  709. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
  710. *
  711. * In correlation to an array, this would be the current index
  712. */
  713. readonly currentFrame: number;
  714. /**
  715. * Get the FPS value of this animation
  716. */
  717. readonly fps: number;
  718. /**
  719. * Set the play mode.
  720. * If the animation is played, it will continue playing at least once more, depending on the new play mode set.
  721. * If the animation is not set, the will be initialized and will wait for the user to start playing it.
  722. */
  723. playMode: AnimationPlayMode;
  724. /**
  725. * Reset the animation group
  726. */
  727. reset(): void;
  728. /**
  729. * Restart the animation group
  730. */
  731. restart(): void;
  732. /**
  733. *
  734. * @param frameNumber Go to a specific frame in the animation
  735. */
  736. goToFrame(frameNumber: number): void;
  737. /**
  738. * Start playing the animation.
  739. */
  740. start(): void;
  741. /**
  742. * Pause the animation
  743. */
  744. pause(): void;
  745. /**
  746. * Stop the animation.
  747. * This will fail silently if the animation group is already stopped.
  748. */
  749. stop(): void;
  750. /**
  751. * Dispose this animation object.
  752. */
  753. dispose(): void;
  754. }
  755. }
  756. declare module 'babylonjs-viewer/initializer' {
  757. /**
  758. * Select all HTML tags on the page that match the selector and initialize a viewer
  759. *
  760. * @param selector the selector to initialize the viewer on (default is 'babylon')
  761. */
  762. export function InitTags(selector?: string): void;
  763. }
  764. declare module 'babylonjs-viewer/configuration/configuration' {
  765. import { ITemplateConfiguration } from 'babylonjs-viewer/templateManager';
  766. export interface ViewerConfiguration {
  767. version?: string;
  768. extends?: string;
  769. pageUrl?: string;
  770. configuration?: string | {
  771. url?: string;
  772. payload?: any;
  773. mapper?: string;
  774. };
  775. observers?: IObserversConfiguration;
  776. canvasElement?: string;
  777. model?: IModelConfiguration | string;
  778. scene?: ISceneConfiguration;
  779. optimizer?: ISceneOptimizerConfiguration | boolean;
  780. camera?: ICameraConfiguration;
  781. skybox?: boolean | ISkyboxConfiguration;
  782. ground?: boolean | IGroundConfiguration;
  783. lights?: {
  784. [name: string]: boolean | ILightConfiguration;
  785. };
  786. engine?: {
  787. antialiasing?: boolean;
  788. disableResize?: boolean;
  789. engineOptions?: {
  790. [key: string]: any;
  791. };
  792. adaptiveQuality?: boolean;
  793. };
  794. templates?: {
  795. main: ITemplateConfiguration;
  796. [key: string]: ITemplateConfiguration;
  797. };
  798. customShaders?: {
  799. shaders?: {
  800. [key: string]: string;
  801. };
  802. includes?: {
  803. [key: string]: string;
  804. };
  805. };
  806. lab?: {
  807. flashlight?: boolean | {
  808. exponent?: number;
  809. angle?: number;
  810. intensity?: number;
  811. diffuse?: {
  812. r: number;
  813. g: number;
  814. b: number;
  815. };
  816. specular?: {
  817. r: number;
  818. g: number;
  819. b: number;
  820. };
  821. };
  822. hideLoadingDelay?: number;
  823. };
  824. }
  825. export interface IModelConfiguration {
  826. url?: string;
  827. root?: string;
  828. loader?: string;
  829. position?: {
  830. x: number;
  831. y: number;
  832. z: number;
  833. };
  834. rotation?: {
  835. x: number;
  836. y: number;
  837. z: number;
  838. w?: number;
  839. };
  840. scaling?: {
  841. x: number;
  842. y: number;
  843. z: number;
  844. };
  845. parentObjectIndex?: number;
  846. castShadow?: boolean;
  847. normalize?: boolean | {
  848. center?: boolean;
  849. unitSize?: boolean;
  850. parentIndex?: number;
  851. };
  852. title?: string;
  853. subtitle?: string;
  854. thumbnail?: string;
  855. animation?: {
  856. autoStart?: boolean | string;
  857. playOnce?: boolean;
  858. };
  859. }
  860. export interface ISkyboxConfiguration {
  861. cubeTexture?: {
  862. noMipMap?: boolean;
  863. gammaSpace?: boolean;
  864. url?: string | Array<string>;
  865. };
  866. color?: {
  867. r: number;
  868. g: number;
  869. b: number;
  870. };
  871. pbr?: boolean;
  872. scale?: number;
  873. blur?: number;
  874. material?: {
  875. imageProcessingConfiguration?: IImageProcessingConfiguration;
  876. [propName: string]: any;
  877. };
  878. infiniteDIstance?: boolean;
  879. }
  880. export interface IGroundConfiguration {
  881. size?: number;
  882. receiveShadows?: boolean;
  883. shadowLevel?: number;
  884. shadowOnly?: boolean;
  885. mirror?: boolean | {
  886. sizeRatio?: number;
  887. blurKernel?: number;
  888. amount?: number;
  889. fresnelWeight?: number;
  890. fallOffDistance?: number;
  891. textureType?: number;
  892. };
  893. texture?: string;
  894. color?: {
  895. r: number;
  896. g: number;
  897. b: number;
  898. };
  899. opacity?: number;
  900. material?: {
  901. [propName: string]: any;
  902. };
  903. }
  904. export interface ISceneConfiguration {
  905. debug?: boolean;
  906. autoRotate?: boolean;
  907. rotationSpeed?: number;
  908. defaultCamera?: boolean;
  909. defaultLight?: boolean;
  910. clearColor?: {
  911. r: number;
  912. g: number;
  913. b: number;
  914. a: number;
  915. };
  916. imageProcessingConfiguration?: IImageProcessingConfiguration;
  917. environmentTexture?: string;
  918. }
  919. export interface ISceneOptimizerConfiguration {
  920. targetFrameRate?: number;
  921. trackerDuration?: number;
  922. autoGeneratePriorities?: boolean;
  923. improvementMode?: boolean;
  924. degradation?: string;
  925. types?: {
  926. texture?: ISceneOptimizerParameters;
  927. hardwareScaling?: ISceneOptimizerParameters;
  928. shadow?: ISceneOptimizerParameters;
  929. postProcess?: ISceneOptimizerParameters;
  930. lensFlare?: ISceneOptimizerParameters;
  931. particles?: ISceneOptimizerParameters;
  932. renderTarget?: ISceneOptimizerParameters;
  933. mergeMeshes?: ISceneOptimizerParameters;
  934. };
  935. }
  936. export interface IObserversConfiguration {
  937. onEngineInit?: string;
  938. onSceneInit?: string;
  939. onModelLoaded?: string;
  940. }
  941. export interface ICameraConfiguration {
  942. position?: {
  943. x: number;
  944. y: number;
  945. z: number;
  946. };
  947. rotation?: {
  948. x: number;
  949. y: number;
  950. z: number;
  951. w: number;
  952. };
  953. fov?: number;
  954. fovMode?: number;
  955. minZ?: number;
  956. maxZ?: number;
  957. inertia?: number;
  958. behaviors?: {
  959. [name: string]: number | {
  960. type: number;
  961. [propName: string]: any;
  962. };
  963. };
  964. [propName: string]: any;
  965. }
  966. export interface ILightConfiguration {
  967. type: number;
  968. name?: string;
  969. disabled?: boolean;
  970. position?: {
  971. x: number;
  972. y: number;
  973. z: number;
  974. };
  975. target?: {
  976. x: number;
  977. y: number;
  978. z: number;
  979. };
  980. direction?: {
  981. x: number;
  982. y: number;
  983. z: number;
  984. };
  985. diffuse?: {
  986. r: number;
  987. g: number;
  988. b: number;
  989. };
  990. specular?: {
  991. r: number;
  992. g: number;
  993. b: number;
  994. };
  995. intensity?: number;
  996. intensityMode?: number;
  997. radius?: number;
  998. shadownEnabled?: boolean;
  999. shadowConfig?: {
  1000. useBlurExponentialShadowMap?: boolean;
  1001. useKernelBlur?: boolean;
  1002. blurKernel?: number;
  1003. blurScale?: number;
  1004. minZ?: number;
  1005. maxZ?: number;
  1006. frustumSize?: number;
  1007. angleScale?: number;
  1008. [propName: string]: any;
  1009. };
  1010. [propName: string]: any;
  1011. behaviors?: {
  1012. [name: string]: number | {
  1013. type: number;
  1014. [propName: string]: any;
  1015. };
  1016. };
  1017. }
  1018. export interface ISceneOptimizerParameters {
  1019. priority?: number;
  1020. maximumSize?: number;
  1021. step?: number;
  1022. }
  1023. export interface IImageProcessingConfiguration {
  1024. colorGradingEnabled?: boolean;
  1025. colorCurvesEnabled?: boolean;
  1026. colorCurves?: {
  1027. globalHue?: number;
  1028. globalDensity?: number;
  1029. globalSaturation?: number;
  1030. globalExposure?: number;
  1031. highlightsHue?: number;
  1032. highlightsDensity?: number;
  1033. highlightsSaturation?: number;
  1034. highlightsExposure?: number;
  1035. midtonesHue?: number;
  1036. midtonesDensity?: number;
  1037. midtonesSaturation?: number;
  1038. midtonesExposure?: number;
  1039. shadowsHue?: number;
  1040. shadowsDensity?: number;
  1041. shadowsSaturation?: number;
  1042. shadowsExposure?: number;
  1043. };
  1044. colorGradingWithGreenDepth?: boolean;
  1045. colorGradingBGR?: boolean;
  1046. exposure?: number;
  1047. toneMappingEnabled?: boolean;
  1048. contrast?: number;
  1049. vignetteEnabled?: boolean;
  1050. vignetteStretch?: number;
  1051. vignetteCentreX?: number;
  1052. vignetteCentreY?: number;
  1053. vignetteWeight?: number;
  1054. vignetteColor?: {
  1055. r: number;
  1056. g: number;
  1057. b: number;
  1058. a?: number;
  1059. };
  1060. vignetteCameraFov?: number;
  1061. vignetteBlendMode?: number;
  1062. vignetteM?: boolean;
  1063. applyByPostProcess?: boolean;
  1064. isEnabled?: boolean;
  1065. }
  1066. }
  1067. declare module 'babylonjs-viewer/templateManager' {
  1068. import { Observable } from 'babylonjs';
  1069. /**
  1070. * A single template configuration object
  1071. */
  1072. export interface ITemplateConfiguration {
  1073. location?: string;
  1074. html?: string;
  1075. id?: string;
  1076. params?: {
  1077. [key: string]: string | number | boolean | object;
  1078. };
  1079. events?: {
  1080. pointerdown?: boolean | {
  1081. [id: string]: boolean;
  1082. };
  1083. pointerup?: boolean | {
  1084. [id: string]: boolean;
  1085. };
  1086. pointermove?: boolean | {
  1087. [id: string]: boolean;
  1088. };
  1089. pointerover?: boolean | {
  1090. [id: string]: boolean;
  1091. };
  1092. pointerout?: boolean | {
  1093. [id: string]: boolean;
  1094. };
  1095. pointerenter?: boolean | {
  1096. [id: string]: boolean;
  1097. };
  1098. pointerleave?: boolean | {
  1099. [id: string]: boolean;
  1100. };
  1101. pointercancel?: boolean | {
  1102. [id: string]: boolean;
  1103. };
  1104. click?: boolean | {
  1105. [id: string]: boolean;
  1106. };
  1107. dragstart?: boolean | {
  1108. [id: string]: boolean;
  1109. };
  1110. drop?: boolean | {
  1111. [id: string]: boolean;
  1112. };
  1113. [key: string]: boolean | {
  1114. [id: string]: boolean;
  1115. } | undefined;
  1116. };
  1117. }
  1118. /**
  1119. * The object sent when an event is triggered
  1120. */
  1121. export interface EventCallback {
  1122. event: Event;
  1123. template: Template;
  1124. selector: string;
  1125. payload?: any;
  1126. }
  1127. /**
  1128. * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
  1129. * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
  1130. */
  1131. export class TemplateManager {
  1132. containerElement: HTMLElement;
  1133. /**
  1134. * Will be triggered when any template is initialized
  1135. */
  1136. onTemplateInit: Observable<Template>;
  1137. /**
  1138. * Will be triggered when any template is fully loaded
  1139. */
  1140. onTemplateLoaded: Observable<Template>;
  1141. /**
  1142. * Will be triggered when a template state changes
  1143. */
  1144. onTemplateStateChange: Observable<Template>;
  1145. /**
  1146. * Will be triggered when all templates finished loading
  1147. */
  1148. onAllLoaded: Observable<TemplateManager>;
  1149. /**
  1150. * Will be triggered when any event on any template is triggered.
  1151. */
  1152. onEventTriggered: Observable<EventCallback>;
  1153. /**
  1154. * This template manager's event manager. In charge of callback registrations to native event types
  1155. */
  1156. eventManager: EventManager;
  1157. constructor(containerElement: HTMLElement);
  1158. /**
  1159. * Initialize the template(s) for the viewer. Called bay the Viewer class
  1160. * @param templates the templates to be used to initialize the main template
  1161. */
  1162. initTemplate(templates: {
  1163. [key: string]: ITemplateConfiguration;
  1164. }): Promise<void>;
  1165. /**
  1166. * Get the canvas in the template tree.
  1167. * There must be one and only one canvas inthe template.
  1168. */
  1169. getCanvas(): HTMLCanvasElement | null;
  1170. /**
  1171. * Get a specific template from the template tree
  1172. * @param name the name of the template to load
  1173. */
  1174. getTemplate(name: string): Template | undefined;
  1175. /**
  1176. * Dispose the template manager
  1177. */
  1178. dispose(): void;
  1179. }
  1180. import { EventManager } from 'babylonjs-viewer/eventManager';
  1181. /**
  1182. * This class represents a single template in the viewer's template tree.
  1183. * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
  1184. * A template is injected using the template manager in the correct position.
  1185. * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
  1186. *
  1187. * For further information please refer to the documentation page, https://doc.babylonjs.com
  1188. */
  1189. export class Template {
  1190. name: string;
  1191. /**
  1192. * Will be triggered when the template is loaded
  1193. */
  1194. onLoaded: Observable<Template>;
  1195. /**
  1196. * will be triggered when the template is appended to the tree
  1197. */
  1198. onAppended: Observable<Template>;
  1199. /**
  1200. * Will be triggered when the template's state changed (shown, hidden)
  1201. */
  1202. onStateChange: Observable<Template>;
  1203. /**
  1204. * Will be triggered when an event is triggered on ths template.
  1205. * The event is a native browser event (like mouse or pointer events)
  1206. */
  1207. onEventTriggered: Observable<EventCallback>;
  1208. /**
  1209. * is the template loaded?
  1210. */
  1211. isLoaded: boolean;
  1212. /**
  1213. * This is meant to be used to track the show and hide functions.
  1214. * This is NOT (!!) a flag to check if the element is actually visible to the user.
  1215. */
  1216. isShown: boolean;
  1217. /**
  1218. * Is this template a part of the HTML tree (the template manager injected it)
  1219. */
  1220. isInHtmlTree: boolean;
  1221. /**
  1222. * The HTML element containing this template
  1223. */
  1224. parent: HTMLElement;
  1225. /**
  1226. * A promise that is fulfilled when the template finished loading.
  1227. */
  1228. initPromise: Promise<Template>;
  1229. constructor(name: string, _configuration: ITemplateConfiguration);
  1230. /**
  1231. * Some templates have parameters (like background color for example).
  1232. * The parameters are provided to Handlebars which in turn generates the template.
  1233. * This function will update the template with the new parameters
  1234. *
  1235. * @param params the new template parameters
  1236. */
  1237. updateParams(params: {
  1238. [key: string]: string | number | boolean | object;
  1239. }): void;
  1240. /**
  1241. * Get the template'S configuration
  1242. */
  1243. readonly configuration: ITemplateConfiguration;
  1244. /**
  1245. * A template can be a parent element for other templates or HTML elements.
  1246. * This function will deliver all child HTML elements of this template.
  1247. */
  1248. getChildElements(): Array<string>;
  1249. /**
  1250. * Appending the template to a parent HTML element.
  1251. * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
  1252. * @param parent the parent to which the template is added
  1253. * @param forceRemove if the parent already exists, shoud the template be removed from it?
  1254. */
  1255. appendTo(parent: HTMLElement, forceRemove?: boolean): void;
  1256. /**
  1257. * Show the template using the provided visibilityFunction, or natively using display: flex.
  1258. * The provided function returns a promise that should be fullfilled when the element is shown.
  1259. * Since it is a promise async operations are more than possible.
  1260. * See the default viewer for an opacity example.
  1261. * @param visibilityFunction The function to execute to show the template.
  1262. */
  1263. show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1264. /**
  1265. * Hide the template using the provided visibilityFunction, or natively using display: none.
  1266. * The provided function returns a promise that should be fullfilled when the element is hidden.
  1267. * Since it is a promise async operations are more than possible.
  1268. * See the default viewer for an opacity example.
  1269. * @param visibilityFunction The function to execute to show the template.
  1270. */
  1271. hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1272. /**
  1273. * Dispose this template
  1274. */
  1275. dispose(): void;
  1276. }
  1277. }
  1278. declare module 'babylonjs-viewer/configuration/loader' {
  1279. import { ViewerConfiguration } from 'babylonjs-viewer/configuration/configuration';
  1280. /**
  1281. * The configuration loader will load the configuration object from any source and will use the defined mapper to
  1282. * parse the object and return a conform ViewerConfiguration.
  1283. * It is a private member of the scene.
  1284. */
  1285. export class ConfigurationLoader {
  1286. constructor(_enableCache?: boolean);
  1287. /**
  1288. * load a configuration object that is defined in the initial configuration provided.
  1289. * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
  1290. *
  1291. * @param initConfig the initial configuration that has the definitions of further configuration to load.
  1292. * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
  1293. * @returns A promise that delivers the extended viewer configuration, when done.
  1294. */
  1295. loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
  1296. /**
  1297. * Dispose the configuration loader. This will cancel file requests, if active.
  1298. */
  1299. dispose(): void;
  1300. }
  1301. }
  1302. declare module 'babylonjs-viewer/' {
  1303. import { mapperManager } from 'babylonjs-viewer/configuration/mappers';
  1304. import { viewerManager } from 'babylonjs-viewer/viewer/viewerManager';
  1305. import { DefaultViewer } from 'babylonjs-viewer/viewer/defaultViewer';
  1306. import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
  1307. import { ModelLoader } from 'babylonjs-viewer/model/modelLoader';
  1308. import { ViewerModel, ModelState } from 'babylonjs-viewer/model/viewerModel';
  1309. import { AnimationPlayMode, AnimationState } from 'babylonjs-viewer/model/modelAnimation';
  1310. import 'babylonjs-loaders';
  1311. import 'pep';
  1312. import { InitTags } from 'babylonjs-viewer/initializer';
  1313. export let disableInit: boolean;
  1314. /**
  1315. * Dispose all viewers currently registered
  1316. */
  1317. function disposeAll(): void;
  1318. export { InitTags, DefaultViewer, AbstractViewer, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState };
  1319. }
  1320. declare module 'babylonjs-viewer/eventManager' {
  1321. import { EventCallback, TemplateManager } from "babylonjs-viewer/templateManager";
  1322. /**
  1323. * The EventManager is in charge of registering user interctions with the viewer.
  1324. * It is used in the TemplateManager
  1325. */
  1326. export class EventManager {
  1327. constructor(_templateManager: TemplateManager);
  1328. /**
  1329. * Register a new callback to a specific template.
  1330. * The best example for the usage can be found in the DefaultViewer
  1331. *
  1332. * @param templateName the templateName to register the event to
  1333. * @param callback The callback to be executed
  1334. * @param eventType the type of event to register
  1335. * @param selector an optional selector. if not defined the parent object in the template will be selected
  1336. */
  1337. registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1338. /**
  1339. * This will remove a registered event from the defined template.
  1340. * Each one of the variables apart from the template name are optional, but one must be provided.
  1341. *
  1342. * @param templateName the templateName
  1343. * @param callback the callback to remove (optional)
  1344. * @param eventType the event type to remove (optional)
  1345. * @param selector the selector from which to remove the event (optional)
  1346. */
  1347. unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1348. /**
  1349. * Dispose the event manager
  1350. */
  1351. dispose(): void;
  1352. }
  1353. }