babylon.viewer.module.d.ts 57 KB

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