babylon.viewer.d.ts 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961
  1. /// <reference path="./babylon.d.ts"/>
  2. /// <reference path="./babylon.glTF2Interface.d.ts"/>
  3. /// <reference path="./babylonjs.loaders.d.ts"/>
  4. declare module "babylonjs-loaders"{ export=BABYLON;}
  5. // Generated by dts-bundle v0.7.3
  6. // Dependencies for this module:
  7. // ../../../../../Tools/Gulp/babylonjs
  8. // ../../../../../Tools/Gulp/babylonjs-loaders
  9. declare module BabylonViewer {
  10. /**
  11. * BabylonJS Viewer
  12. *
  13. * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions.
  14. */
  15. let disableInit: boolean;
  16. /**
  17. * Dispose all viewers currently registered
  18. */
  19. function disposeAll(): void;
  20. const Version: string;
  21. }
  22. declare module BabylonViewer {
  23. /**
  24. * This is the mapper's interface. Implement this function to create your own mapper and register it at the mapper manager
  25. */
  26. export interface IMapper {
  27. map(rawSource: any): ViewerConfiguration;
  28. }
  29. /**
  30. * The MapperManager manages the different implemented mappers.
  31. * It allows the user to register new mappers as well and use them to parse their own configuration data
  32. */
  33. export class MapperManager {
  34. /**
  35. * The default mapper is the JSON mapper.
  36. */
  37. static DefaultMapper: string;
  38. constructor();
  39. /**
  40. * Get a specific configuration mapper.
  41. *
  42. * @param type the name of the mapper to load
  43. */
  44. getMapper(type: string): IMapper;
  45. /**
  46. * Use this functio to register your own configuration mapper.
  47. * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.
  48. * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper
  49. * @param mapper The implemented mapper
  50. */
  51. registerMapper(type: string, mapper: IMapper): void;
  52. /**
  53. * Dispose the mapper manager and all of its mappers.
  54. */
  55. dispose(): void;
  56. }
  57. /**
  58. * mapperManager is a singleton of the type MapperManager.
  59. * The mapperManager can be disposed directly with calling mapperManager.dispose()
  60. * or indirectly with using BabylonViewer.disposeAll()
  61. */
  62. export let mapperManager: MapperManager;
  63. }
  64. declare module BabylonViewer {
  65. export class ViewerGlobals {
  66. disableInit: boolean;
  67. disableWebGL2Support: boolean;
  68. readonly version: string;
  69. }
  70. export let viewerGlobals: ViewerGlobals;
  71. }
  72. declare module BabylonViewer {
  73. /**
  74. * The viewer manager is the container for all viewers currently registered on this page.
  75. * It is possible to have more than one viewer on a single page.
  76. */
  77. export class ViewerManager {
  78. /**
  79. * A callback that will be triggered when a new viewer was added
  80. */
  81. onViewerAdded: (viewer: AbstractViewer) => void;
  82. /**
  83. * Will notify when a new viewer was added
  84. */
  85. onViewerAddedObservable: BABYLON.Observable<AbstractViewer>;
  86. /**
  87. * Will notify when a viewer was removed (disposed)
  88. */
  89. onViewerRemovedObservable: BABYLON.Observable<string>;
  90. constructor();
  91. /**
  92. * Adding a new viewer to the viewer manager and start tracking it.
  93. * @param viewer the viewer to add
  94. */
  95. addViewer(viewer: AbstractViewer): void;
  96. /**
  97. * remove a viewer from the viewer manager
  98. * @param viewer the viewer to remove
  99. */
  100. removeViewer(viewer: AbstractViewer): void;
  101. /**
  102. * 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)
  103. * @param id the id of the HTMl element (or the viewer's, if none provided)
  104. */
  105. getViewerById(id: string): AbstractViewer;
  106. /**
  107. * Get a viewer using a container element
  108. * @param element the HTML element to search viewers associated with
  109. */
  110. getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
  111. /**
  112. * Get a promise that will fullfil when this viewer was initialized.
  113. * Since viewer initialization and template injection is asynchronous, using the promise will guaranty that
  114. * you will get the viewer after everything was already configured.
  115. * @param id the viewer id to find
  116. */
  117. getViewerPromiseById(id: string): Promise<AbstractViewer>;
  118. /**
  119. * dispose the manager and all of its associated viewers
  120. */
  121. dispose(): void;
  122. }
  123. export let viewerManager: ViewerManager;
  124. }
  125. declare module BabylonViewer {
  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: Element;
  132. fullscreenElement?: Element;
  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: Element, initialConfiguration?: ViewerConfiguration);
  139. registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
  140. /**
  141. * This will be executed when the templates initialize.
  142. */
  143. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  144. protected _initVR(): void;
  145. /**
  146. * Toggle fullscreen of the entire viewer
  147. */
  148. toggleFullscreen: () => void;
  149. /**
  150. * Preparing the container element to present the viewer
  151. */
  152. protected _prepareContainerElement(): void;
  153. /**
  154. * This function will configure the templates and update them after a model was loaded
  155. * It is mainly responsible to changing the title and subtitle etc'.
  156. * @param model the model to be used to configure the templates by
  157. */
  158. protected _configureTemplate(model?: ViewerModel): void;
  159. /**
  160. * This will load a new model to the default viewer
  161. * overriding the AbstractViewer's loadModel.
  162. * The scene will automatically be cleared of the old models, if exist.
  163. * @param model the configuration object (or URL) to load.
  164. */
  165. loadModel(model?: string | File | IModelConfiguration): Promise<ViewerModel>;
  166. /**
  167. * Show the overlay and the defined sub-screen.
  168. * Mainly used for help and errors
  169. * @param subScreen the name of the subScreen. Those can be defined in the configuration object
  170. */
  171. showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
  172. /**
  173. * Hide the overlay screen.
  174. */
  175. hideOverlayScreen(): Promise<string> | Promise<Template>;
  176. /**
  177. * show the viewer (in case it was hidden)
  178. *
  179. * @param visibilityFunction an optional function to execute in order to show the container
  180. */
  181. show(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
  182. /**
  183. * hide the viewer (in case it is visible)
  184. *
  185. * @param visibilityFunction an optional function to execute in order to hide the container
  186. */
  187. hide(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
  188. /**
  189. * Show the loading screen.
  190. * The loading screen can be configured using the configuration object
  191. */
  192. showLoadingScreen(): Promise<string> | Promise<Template>;
  193. /**
  194. * Hide the loading screen
  195. */
  196. hideLoadingScreen(): Promise<string> | Promise<Template>;
  197. dispose(): void;
  198. protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
  199. }
  200. }
  201. declare module BabylonViewer {
  202. /**
  203. * The AbstractViewer is the center of Babylon's viewer.
  204. * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
  205. */
  206. export abstract class AbstractViewer {
  207. containerElement: Element;
  208. /**
  209. * The corresponsing template manager of this viewer.
  210. */
  211. templateManager: TemplateManager;
  212. /**
  213. * Babylon BABYLON.Engine corresponding with this viewer
  214. */
  215. engine: BABYLON.Engine;
  216. /**
  217. * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
  218. */
  219. readonly baseId: string;
  220. /**
  221. * The last loader used to load a model.
  222. * @deprecated
  223. */
  224. lastUsedLoader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
  225. /**
  226. * The ModelLoader instance connected with this viewer.
  227. */
  228. modelLoader: ModelLoader;
  229. /**
  230. * A flag that controls whether or not the render loop should be executed
  231. */
  232. runRenderLoop: boolean;
  233. /**
  234. * The scene manager connected with this viewer instance
  235. */
  236. sceneManager: SceneManager;
  237. /**
  238. * Will notify when the scene was initialized
  239. */
  240. readonly onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  241. /**
  242. * will notify when the engine was initialized
  243. */
  244. readonly onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
  245. /**
  246. * Will notify when a new model was added to the scene.
  247. * Note that added does not neccessarily mean loaded!
  248. */
  249. readonly onModelAddedObservable: BABYLON.Observable<ViewerModel>;
  250. /**
  251. * will notify after every model load
  252. */
  253. readonly onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
  254. /**
  255. * will notify when any model notify of progress
  256. */
  257. readonly onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  258. /**
  259. * will notify when any model load failed.
  260. */
  261. readonly onModelLoadErrorObservable: BABYLON.Observable<{
  262. message: string;
  263. exception: any;
  264. }>;
  265. /**
  266. * Will notify when a model was removed from the scene;
  267. */
  268. readonly onModelRemovedObservable: BABYLON.Observable<ViewerModel>;
  269. /**
  270. * will notify when a new loader was initialized.
  271. * Used mainly to know when a model starts loading.
  272. */
  273. readonly onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
  274. /**
  275. * Observers registered here will be executed when the entire load process has finished.
  276. */
  277. readonly onInitDoneObservable: BABYLON.Observable<AbstractViewer>;
  278. /**
  279. * Functions added to this observable will be executed on each frame rendered.
  280. */
  281. readonly onFrameRenderedObservable: BABYLON.Observable<AbstractViewer>;
  282. /**
  283. * Observers registered here will be executed when VR more is entered.
  284. */
  285. readonly onEnteringVRObservable: BABYLON.Observable<AbstractViewer>;
  286. /**
  287. * Observers registered here will be executed when VR mode is exited.
  288. */
  289. readonly onExitingVRObservable: BABYLON.Observable<AbstractViewer>;
  290. observablesManager: ObservablesManager;
  291. /**
  292. * The canvas associated with this viewer
  293. */
  294. protected _canvas: HTMLCanvasElement;
  295. /**
  296. * The (single) canvas of this viewer
  297. */
  298. readonly canvas: HTMLCanvasElement;
  299. /**
  300. * is this viewer disposed?
  301. */
  302. protected _isDisposed: boolean;
  303. /**
  304. * registered onBeforeRender functions.
  305. * This functions are also registered at the native scene. The reference can be used to unregister them.
  306. */
  307. protected _registeredOnBeforeRenderFunctions: Array<() => void>;
  308. /**
  309. * The configuration loader of this viewer
  310. */
  311. protected _configurationLoader: ConfigurationLoader;
  312. /**
  313. * Is the viewer already initialized. for internal use.
  314. */
  315. protected _isInit: boolean;
  316. protected _configurationContainer: ConfigurationContainer;
  317. readonly configurationContainer: ConfigurationContainer;
  318. constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
  319. /**
  320. * get the baseId of this viewer
  321. */
  322. getBaseId(): string;
  323. /**
  324. * Do we have a canvas to render on, and is it a part of the scene
  325. */
  326. isCanvasInDOM(): boolean;
  327. /**
  328. * Set the viewer's background rendering flag.
  329. */
  330. renderInBackground: boolean;
  331. /**
  332. * Get the configuration object. This is a reference only.
  333. * The configuration can ONLY be updated using the updateConfiguration function.
  334. * changing this object will have no direct effect on the scene.
  335. */
  336. readonly configuration: ViewerConfiguration;
  337. /**
  338. * force resizing the engine.
  339. */
  340. forceResize(): void;
  341. protected _hdToggled: boolean;
  342. toggleHD(): void;
  343. protected _vrToggled: boolean;
  344. protected _vrScale: number;
  345. protected _vrInit: boolean;
  346. toggleVR(): void;
  347. protected _initVR(): void;
  348. /**
  349. * The resize function that will be registered with the window object
  350. */
  351. protected _resize: () => void;
  352. protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
  353. /**
  354. * Force a single render loop execution.
  355. */
  356. forceRender(): void;
  357. /**
  358. * render loop that will be executed by the engine
  359. */
  360. protected _render: (force?: boolean) => void;
  361. /**
  362. * Takes a screenshot of the scene and returns it as a base64 encoded png.
  363. * @param callback optional callback that will be triggered when screenshot is done.
  364. * @param width Optional screenshot width (default to 512).
  365. * @param height Optional screenshot height (default to 512).
  366. * @returns a promise with the screenshot data
  367. */
  368. takeScreenshot(callback?: (data: string) => void, width?: number, height?: number): Promise<string>;
  369. /**
  370. * Update the current viewer configuration with new values.
  371. * Only provided information will be updated, old configuration values will be kept.
  372. * If this.configuration was manually changed, you can trigger this function with no parameters,
  373. * and the entire configuration will be updated.
  374. * @param newConfiguration the partial configuration to update or a URL to a JSON holding the updated configuration
  375. *
  376. */
  377. updateConfiguration(newConfiguration?: Partial<ViewerConfiguration> | string): void;
  378. /**
  379. * this is used to register native functions using the configuration object.
  380. * This will configure the observers.
  381. * @param observersConfiguration observers configuration
  382. */
  383. protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
  384. /**
  385. * Dispose the entire viewer including the scene and the engine
  386. */
  387. dispose(): void;
  388. /**
  389. * This will prepare the container element for the viewer
  390. */
  391. protected abstract _prepareContainerElement(): any;
  392. /**
  393. * This function will execute when the HTML templates finished initializing.
  394. * It should initialize the engine and continue execution.
  395. *
  396. * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
  397. */
  398. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  399. /**
  400. * This will force the creation of an engine and a scene.
  401. * It will also load a model if preconfigured.
  402. * But first - it will load the extendible onTemplateLoaded()!
  403. */
  404. protected _onTemplateLoaded(): Promise<AbstractViewer>;
  405. /**
  406. * Initialize the engine. Retruns a promise in case async calls are needed.
  407. *
  408. * @protected
  409. * @returns {Promise<BABYLON.Engine>}
  410. * @memberof Viewer
  411. */
  412. protected _initEngine(): Promise<BABYLON.Engine>;
  413. /**
  414. * Initialize a model loading. The returned object (a ViewerModel object) will be loaded in the background.
  415. * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
  416. *
  417. * @param modelConfig model configuration to use when loading the model.
  418. * @param clearScene should the scene be cleared before loading this model
  419. * @returns a ViewerModel object that is not yet fully loaded.
  420. */
  421. initModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): ViewerModel;
  422. /**
  423. * load a model using the provided configuration.
  424. * This function, as opposed to initModel, will return a promise that resolves when the model is loaded, and rejects with error.
  425. * If you want to attach to the observables of the model, use initModle instead.
  426. *
  427. * @param modelConfig the model configuration or URL to load.
  428. * @param clearScene Should the scene be cleared before loading the model
  429. * @returns a Promise the fulfills when the model finished loading successfully.
  430. */
  431. loadModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): Promise<ViewerModel>;
  432. protected _initTelemetryEvents(): void;
  433. /**
  434. * Injects all the spectre shader in the babylon shader store
  435. */
  436. protected _injectCustomShaders(): void;
  437. }
  438. }
  439. declare module BabylonViewer {
  440. /**
  441. * The data structure of a telemetry event.
  442. */
  443. export interface TelemetryData {
  444. event: string;
  445. session: string;
  446. date: Date;
  447. now: number;
  448. viewerId?: string;
  449. detail: any;
  450. }
  451. /**
  452. * Receives Telemetry events and raises events to the API
  453. */
  454. export class TelemetryManager {
  455. onEventBroadcastedObservable: BABYLON.Observable<TelemetryData>;
  456. /**
  457. * Receives a telemetry event
  458. * @param event The name of the Telemetry event
  459. * @param details An additional value, or an object containing a list of property/value pairs
  460. */
  461. readonly broadcast: (event: string, viewerId?: string | undefined, details?: any) => void;
  462. /**
  463. * Log a Telemetry event for errors raised on the WebGL context.
  464. * @param engine The Babylon engine with the WebGL context.
  465. */
  466. flushWebGLErrors(engine: BABYLON.Engine, viewerId?: string): void;
  467. /**
  468. * Enable or disable telemetry events
  469. * @param enabled Boolan, true if events are enabled
  470. */
  471. enable: boolean;
  472. /**
  473. * Returns the current session ID or creates one if it doesn't exixt
  474. * @return The current session ID
  475. */
  476. readonly session: string;
  477. /**
  478. * Disposes the telemetry manager
  479. */
  480. dispose(): void;
  481. }
  482. export const telemetryManager: TelemetryManager;
  483. }
  484. declare module BabylonViewer {
  485. /**
  486. * An instance of the class is in charge of loading the model correctly.
  487. * This class will continously be expended with tasks required from the specific loaders Babylon has.
  488. *
  489. * A Model loader is unique per (Abstract)Viewer. It is being generated by the viewer
  490. */
  491. export class ModelLoader {
  492. readonly baseUrl: string;
  493. /**
  494. * Create a new Model loader
  495. * @param _viewer the viewer using this model loader
  496. */
  497. constructor(_observablesManager: ObservablesManager, _configurationContainer?: ConfigurationContainer | undefined);
  498. /**
  499. * Adds a new plugin to the loader process.
  500. *
  501. * @param plugin the plugin name or the plugin itself
  502. */
  503. addPlugin(plugin: ILoaderPlugin | string): void;
  504. /**
  505. * Load a model using predefined configuration
  506. * @param modelConfiguration the modelConfiguration to use to load the model
  507. */
  508. load(modelConfiguration: IModelConfiguration): ViewerModel;
  509. cancelLoad(model: ViewerModel): void;
  510. /**
  511. * dispose the model loader.
  512. * If loaders are registered and are in the middle of loading, they will be disposed and the request(s) will be cancelled.
  513. */
  514. dispose(): void;
  515. }
  516. }
  517. declare module BabylonViewer {
  518. /**
  519. * The current state of the model
  520. */
  521. export enum ModelState {
  522. INIT = 0,
  523. LOADING = 1,
  524. LOADED = 2,
  525. ENTRY = 3,
  526. ENTRYDONE = 4,
  527. COMPLETE = 5,
  528. CANCELED = 6,
  529. ERROR = 7
  530. }
  531. /**
  532. * The viewer model is a container for all assets representing a sngle loaded model.
  533. */
  534. export class ViewerModel implements BABYLON.IDisposable {
  535. /**
  536. * The loader used to load this model.
  537. */
  538. loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
  539. /**
  540. * This model's root mesh (the parent of all other meshes).
  541. * This mesh does not(!) exist in the meshes array.
  542. */
  543. rootMesh: BABYLON.AbstractMesh;
  544. /**
  545. * ParticleSystems connected to this model
  546. */
  547. particleSystems: Array<BABYLON.IParticleSystem>;
  548. /**
  549. * Skeletons defined in this model
  550. */
  551. skeletons: Array<BABYLON.Skeleton>;
  552. /**
  553. * The current model animation.
  554. * On init, this will be undefined.
  555. */
  556. currentAnimation: IModelAnimation;
  557. /**
  558. * Observers registered here will be executed when the model is done loading
  559. */
  560. onLoadedObservable: BABYLON.Observable<ViewerModel>;
  561. /**
  562. * Observers registered here will be executed when the loader notified of a progress event
  563. */
  564. onLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  565. /**
  566. * Observers registered here will be executed when the loader notified of an error.
  567. */
  568. onLoadErrorObservable: BABYLON.Observable<{
  569. message: string;
  570. exception: any;
  571. }>;
  572. /**
  573. * Will be executed after the model finished loading and complete, including entry animation and lod
  574. */
  575. onCompleteObservable: BABYLON.Observable<ViewerModel>;
  576. /**
  577. * Observers registered here will be executed every time the model is being configured.
  578. * This can be used to extend the model's configuration without extending the class itself
  579. */
  580. onAfterConfigure: BABYLON.Observable<ViewerModel>;
  581. /**
  582. * The current model state (loaded, error, etc)
  583. */
  584. state: ModelState;
  585. /**
  586. * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
  587. */
  588. loadId: number;
  589. loadInfo: BABYLON.GLTF2.IAsset;
  590. constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
  591. shadowsRenderedAfterLoad: boolean;
  592. getViewerId(): string | undefined;
  593. /**
  594. * Set whether this model is enabled or not.
  595. */
  596. enabled: boolean;
  597. loaderDone: boolean;
  598. /**
  599. * Add a mesh to this model.
  600. * Any mesh that has no parent will be provided with the root mesh as its new parent.
  601. *
  602. * @param mesh the new mesh to add
  603. * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
  604. */
  605. addMesh(mesh: BABYLON.AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
  606. /**
  607. * get the list of meshes (excluding the root mesh)
  608. */
  609. readonly meshes: BABYLON.AbstractMesh[];
  610. /**
  611. * (Re-)set the model's entire configuration
  612. * @param newConfiguration the new configuration to replace the new one
  613. */
  614. configuration: IModelConfiguration;
  615. /**
  616. * Update the current configuration with new values.
  617. * Configuration will not be overwritten, but merged with the new configuration.
  618. * Priority is to the new configuration
  619. * @param newConfiguration the configuration to be merged into the current configuration;
  620. */
  621. updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
  622. /**
  623. * Add a new animation group to this model.
  624. * @param animationGroup the new animation group to be added
  625. */
  626. addAnimationGroup(animationGroup: BABYLON.AnimationGroup): void;
  627. /**
  628. * Get the ModelAnimation array
  629. */
  630. getAnimations(): Array<IModelAnimation>;
  631. /**
  632. * Get the animations' names. Using the names you can play a specific animation.
  633. */
  634. getAnimationNames(): Array<string>;
  635. /**
  636. * Get an animation by the provided name. Used mainly when playing n animation.
  637. * @param name the name of the animation to find
  638. */
  639. protected _getAnimationByName(name: string): BABYLON.Nullable<IModelAnimation>;
  640. /**
  641. * Choose an initialized animation using its name and start playing it
  642. * @param name the name of the animation to play
  643. * @returns The model aniamtion to be played.
  644. */
  645. playAnimation(name: string): IModelAnimation;
  646. setCurrentAnimationByName(name: string): IModelAnimation;
  647. /**
  648. * Apply a material configuration to a material
  649. * @param material BABYLON.Material to apply configuration to
  650. * @hidden
  651. */
  652. _applyModelMaterialConfiguration(material: BABYLON.Material): void;
  653. /**
  654. * Begin @animations with the specified @easingFunction
  655. * @param animations The BABYLON Animations to begin
  656. * @param duration of transition, in seconds
  657. * @param easingFunction An easing function to apply
  658. * @param easingMode A easing mode to apply to the easingFunction
  659. * @param onAnimationEnd Call back trigger at the end of the animation.
  660. */
  661. transitionTo(animations: BABYLON.Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
  662. /**
  663. * Stops and removes all animations that have been applied to the model
  664. */
  665. stopAllAnimations(): void;
  666. /**
  667. * Will remove this model from the viewer (but NOT dispose it).
  668. */
  669. remove(): void;
  670. /**
  671. * Dispose this model, including all of its associated assets.
  672. */
  673. dispose(): void;
  674. }
  675. }
  676. declare module BabylonViewer {
  677. /**
  678. * BABYLON.Animation play mode enum - is the animation looping or playing once
  679. */
  680. export const enum AnimationPlayMode {
  681. ONCE = 0,
  682. LOOP = 1
  683. }
  684. /**
  685. * An enum representing the current state of an animation object
  686. */
  687. export const enum AnimationState {
  688. INIT = 0,
  689. PLAYING = 1,
  690. PAUSED = 2,
  691. STOPPED = 3,
  692. ENDED = 4
  693. }
  694. /**
  695. * The different type of easing functions available
  696. */
  697. export const enum EasingFunction {
  698. Linear = 0,
  699. CircleEase = 1,
  700. BackEase = 2,
  701. BounceEase = 3,
  702. CubicEase = 4,
  703. ElasticEase = 5,
  704. ExponentialEase = 6,
  705. PowerEase = 7,
  706. QuadraticEase = 8,
  707. QuarticEase = 9,
  708. QuinticEase = 10,
  709. SineEase = 11
  710. }
  711. /**
  712. * Defines a simple animation to be applied to a model (scale).
  713. */
  714. export interface ModelAnimationConfiguration {
  715. /**
  716. * Time of animation, in seconds
  717. */
  718. time: number;
  719. /**
  720. * Scale to apply
  721. */
  722. scaling?: BABYLON.Vector3;
  723. /**
  724. * Easing function to apply
  725. * See SPECTRE.EasingFunction
  726. */
  727. easingFunction?: number;
  728. /**
  729. * An Easing mode to apply to the easing function
  730. * See BABYLON.EasingFunction
  731. */
  732. easingMode?: number;
  733. }
  734. /**
  735. * This interface can be implemented to define new types of ModelAnimation objects.
  736. */
  737. export interface IModelAnimation {
  738. /**
  739. * Current animation state (playing, stopped etc')
  740. */
  741. readonly state: AnimationState;
  742. /**
  743. * the name of the animation
  744. */
  745. readonly name: string;
  746. /**
  747. * Get the max numbers of frame available in the animation group
  748. *
  749. * In correlation to an arry, this would be ".length"
  750. */
  751. readonly frames: number;
  752. /**
  753. * Get the current frame playing right now.
  754. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
  755. *
  756. * In correlation to an array, this would be the current index
  757. */
  758. readonly currentFrame: number;
  759. /**
  760. * BABYLON.Animation's FPS value
  761. */
  762. readonly fps: number;
  763. /**
  764. * Get or set the animation's speed ration (Frame-to-fps)
  765. */
  766. speedRatio: number;
  767. /**
  768. * Gets or sets the aimation's play mode.
  769. */
  770. playMode: AnimationPlayMode;
  771. /**
  772. * Start the animation
  773. */
  774. start(): any;
  775. /**
  776. * Stop the animation.
  777. * This will fail silently if the animation group is already stopped.
  778. */
  779. stop(): any;
  780. /**
  781. * Pause the animation
  782. * This will fail silently if the animation is not currently playing
  783. */
  784. pause(): any;
  785. /**
  786. * Reset this animation
  787. */
  788. reset(): any;
  789. /**
  790. * Restart the animation
  791. */
  792. restart(): any;
  793. /**
  794. * Go to a specific
  795. * @param frameNumber the frame number to go to
  796. */
  797. goToFrame(frameNumber: number): any;
  798. /**
  799. * Dispose this animation
  800. */
  801. dispose(): any;
  802. }
  803. /**
  804. * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
  805. * native GroupAnimation class.
  806. */
  807. export class GroupModelAnimation implements IModelAnimation {
  808. /**
  809. * Create a new GroupModelAnimation object using an BABYLON.AnimationGroup object
  810. * @param _animationGroup The aniamtion group to base the class on
  811. */
  812. constructor(_animationGroup: BABYLON.AnimationGroup);
  813. /**
  814. * Get the animation's name
  815. */
  816. readonly name: string;
  817. /**
  818. * Get the current animation's state
  819. */
  820. readonly state: AnimationState;
  821. /**
  822. * Sets the speed ratio to use for all animations
  823. */
  824. speedRatio: number;
  825. /**
  826. * Get the max numbers of frame available in the animation group
  827. *
  828. * In correlation to an arry, this would be ".length"
  829. */
  830. readonly frames: number;
  831. /**
  832. * Get the current frame playing right now.
  833. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
  834. *
  835. * In correlation to an array, this would be the current index
  836. */
  837. readonly currentFrame: number;
  838. /**
  839. * Get the FPS value of this animation
  840. */
  841. readonly fps: number;
  842. /**
  843. * Set the play mode.
  844. * If the animation is played, it will continue playing at least once more, depending on the new play mode set.
  845. * If the animation is not set, the will be initialized and will wait for the user to start playing it.
  846. */
  847. playMode: AnimationPlayMode;
  848. /**
  849. * Reset the animation group
  850. */
  851. reset(): void;
  852. /**
  853. * Restart the animation group
  854. */
  855. restart(): void;
  856. /**
  857. *
  858. * @param frameNumber Go to a specific frame in the animation
  859. */
  860. goToFrame(frameNumber: number): void;
  861. /**
  862. * Start playing the animation.
  863. */
  864. start(): void;
  865. /**
  866. * Pause the animation
  867. */
  868. pause(): void;
  869. /**
  870. * Stop the animation.
  871. * This will fail silently if the animation group is already stopped.
  872. */
  873. stop(): void;
  874. /**
  875. * Dispose this animation object.
  876. */
  877. dispose(): void;
  878. }
  879. }
  880. declare module BabylonViewer {
  881. /**
  882. * This interface defines the structure of a loader plugin.
  883. * Any of those functions will be called if (!) the loader supports those callbacks.
  884. * Any loader supports onInit, onLoaded, onError and onProgress.
  885. */
  886. export interface ILoaderPlugin {
  887. onInit?: (loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel) => void;
  888. onLoaded?: (model: ViewerModel) => void;
  889. onError?: (message: string, exception?: any) => void;
  890. onProgress?: (progressEvent: BABYLON.SceneLoaderProgressEvent) => void;
  891. onExtensionLoaded?: (extension: BABYLON.IGLTFLoaderExtension) => void;
  892. onParsed?: (parsedData: BABYLON.IGLTFLoaderData) => void;
  893. onMeshLoaded?: (mesh: BABYLON.AbstractMesh) => void;
  894. onTextureLoaded?: (texture: BABYLON.BaseTexture) => void;
  895. onMaterialLoaded?: (material: BABYLON.Material) => void;
  896. onComplete?: () => void;
  897. }
  898. }
  899. declare module BabylonViewer {
  900. export interface IViewerTemplatePlugin {
  901. readonly templateName: string;
  902. readonly eventsToAttach?: Array<string>;
  903. interactionPredicate(event: EventCallback): boolean;
  904. onEvent?(event: EventCallback): void;
  905. addHTMLTemplate?(template: Template): void;
  906. }
  907. export abstract class AbstractViewerNavbarButton implements IViewerTemplatePlugin {
  908. readonly templateName: string;
  909. readonly eventsToAttach: Array<string>;
  910. protected _prepend: boolean;
  911. protected _buttonName: string;
  912. protected _buttonClass: string;
  913. protected _htmlTemplate: string;
  914. constructor(buttonName: string, buttonClass?: string, htmlTemplate?: string);
  915. interactionPredicate(event: EventCallback): boolean;
  916. abstract onEvent(event: EventCallback): void;
  917. addHTMLTemplate(template: Template): void;
  918. protected _generateHTMLElement(template: Template): Element | DocumentFragment;
  919. }
  920. }
  921. declare module BabylonViewer {
  922. /**
  923. *
  924. * @param name the name of the custom optimizer configuration
  925. * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
  926. */
  927. export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
  928. export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
  929. }
  930. declare module BabylonViewer {
  931. /**
  932. * Will attach an init function the the DOMContentLoaded event.
  933. * The init function will be removed automatically after the event was triggered.
  934. */
  935. export function initListeners(): void;
  936. /**
  937. * Select all HTML tags on the page that match the selector and initialize a viewer
  938. *
  939. * @param selector the selector to initialize the viewer on (default is 'babylon')
  940. */
  941. export function InitTags(selector?: string): void;
  942. }
  943. declare module BabylonViewer {
  944. }
  945. declare module BabylonViewer {
  946. export function getConfigurationKey(key: string, configObject: any): any;
  947. export interface ViewerConfiguration {
  948. version?: string;
  949. extends?: string;
  950. pageUrl?: string;
  951. configuration?: string | {
  952. url?: string;
  953. payload?: any;
  954. mapper?: string;
  955. };
  956. observers?: IObserversConfiguration;
  957. canvasElement?: string;
  958. model?: IModelConfiguration | string;
  959. scene?: ISceneConfiguration;
  960. optimizer?: ISceneOptimizerConfiguration | boolean;
  961. camera?: ICameraConfiguration;
  962. skybox?: boolean | ISkyboxConfiguration;
  963. ground?: boolean | IGroundConfiguration;
  964. lights?: {
  965. [name: string]: number | boolean | ILightConfiguration;
  966. };
  967. engine?: {
  968. renderInBackground?: boolean;
  969. antialiasing?: boolean;
  970. disableResize?: boolean;
  971. engineOptions?: BABYLON.EngineOptions;
  972. adaptiveQuality?: boolean;
  973. hdEnabled?: boolean;
  974. };
  975. templates?: {
  976. main: ITemplateConfiguration;
  977. [key: string]: ITemplateConfiguration;
  978. };
  979. customShaders?: {
  980. shaders?: {
  981. [key: string]: string;
  982. };
  983. includes?: {
  984. [key: string]: string;
  985. };
  986. };
  987. loaderPlugins?: {
  988. extendedMaterial?: boolean;
  989. msftLod?: boolean;
  990. telemetry?: boolean;
  991. minecraft?: boolean;
  992. [propName: string]: boolean | undefined;
  993. };
  994. environmentMap?: IEnvironmentMapConfiguration;
  995. vr?: IVRConfiguration;
  996. lab?: {
  997. flashlight?: boolean | {
  998. exponent?: number;
  999. angle?: number;
  1000. intensity?: number;
  1001. diffuse?: {
  1002. r: number;
  1003. g: number;
  1004. b: number;
  1005. };
  1006. specular?: {
  1007. r: number;
  1008. g: number;
  1009. b: number;
  1010. };
  1011. };
  1012. hideLoadingDelay?: number;
  1013. /** Deprecated */
  1014. assetsRootURL?: string;
  1015. environmentMainColor?: {
  1016. r: number;
  1017. g: number;
  1018. b: number;
  1019. };
  1020. /** Deprecated */
  1021. environmentMap?: {
  1022. /**
  1023. * Environment map texture path in relative to the asset folder.
  1024. */
  1025. texture: string;
  1026. /**
  1027. * Default rotation to apply to the environment map.
  1028. */
  1029. rotationY: number;
  1030. /**
  1031. * Tint level of the main color on the environment map.
  1032. */
  1033. tintLevel: number;
  1034. };
  1035. defaultRenderingPipelines?: boolean | IDefaultRenderingPipelineConfiguration;
  1036. globalLightRotation?: number;
  1037. };
  1038. }
  1039. }
  1040. declare module BabylonViewer {
  1041. /**
  1042. * The object sent when an event is triggered
  1043. */
  1044. export interface EventCallback {
  1045. event: Event;
  1046. template: Template;
  1047. selector: string;
  1048. payload?: any;
  1049. }
  1050. /**
  1051. * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
  1052. * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
  1053. */
  1054. export class TemplateManager {
  1055. containerElement: Element;
  1056. /**
  1057. * Will be triggered when any template is initialized
  1058. */
  1059. onTemplateInit: BABYLON.Observable<Template>;
  1060. /**
  1061. * Will be triggered when any template is fully loaded
  1062. */
  1063. onTemplateLoaded: BABYLON.Observable<Template>;
  1064. /**
  1065. * Will be triggered when a template state changes
  1066. */
  1067. onTemplateStateChange: BABYLON.Observable<Template>;
  1068. /**
  1069. * Will be triggered when all templates finished loading
  1070. */
  1071. onAllLoaded: BABYLON.Observable<TemplateManager>;
  1072. /**
  1073. * Will be triggered when any event on any template is triggered.
  1074. */
  1075. onEventTriggered: BABYLON.Observable<EventCallback>;
  1076. /**
  1077. * This template manager's event manager. In charge of callback registrations to native event types
  1078. */
  1079. eventManager: EventManager;
  1080. constructor(containerElement: Element);
  1081. /**
  1082. * Initialize the template(s) for the viewer. Called bay the Viewer class
  1083. * @param templates the templates to be used to initialize the main template
  1084. */
  1085. initTemplate(templates: {
  1086. [key: string]: ITemplateConfiguration;
  1087. }): Promise<void>;
  1088. /**
  1089. * Get the canvas in the template tree.
  1090. * There must be one and only one canvas inthe template.
  1091. */
  1092. getCanvas(): HTMLCanvasElement | null;
  1093. /**
  1094. * Get a specific template from the template tree
  1095. * @param name the name of the template to load
  1096. */
  1097. getTemplate(name: string): Template | undefined;
  1098. /**
  1099. * Dispose the template manager
  1100. */
  1101. dispose(): void;
  1102. }
  1103. /**
  1104. * This class represents a single template in the viewer's template tree.
  1105. * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
  1106. * A template is injected using the template manager in the correct position.
  1107. * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
  1108. *
  1109. * For further information please refer to the documentation page, https://doc.babylonjs.com
  1110. */
  1111. export class Template {
  1112. name: string;
  1113. /**
  1114. * Will be triggered when the template is loaded
  1115. */
  1116. onLoaded: BABYLON.Observable<Template>;
  1117. /**
  1118. * will be triggered when the template is appended to the tree
  1119. */
  1120. onAppended: BABYLON.Observable<Template>;
  1121. /**
  1122. * Will be triggered when the template's state changed (shown, hidden)
  1123. */
  1124. onStateChange: BABYLON.Observable<Template>;
  1125. /**
  1126. * Will be triggered when an event is triggered on ths template.
  1127. * The event is a native browser event (like mouse or pointer events)
  1128. */
  1129. onEventTriggered: BABYLON.Observable<EventCallback>;
  1130. onParamsUpdated: BABYLON.Observable<Template>;
  1131. onHTMLRendered: BABYLON.Observable<Template>;
  1132. /**
  1133. * is the template loaded?
  1134. */
  1135. isLoaded: boolean;
  1136. /**
  1137. * This is meant to be used to track the show and hide functions.
  1138. * This is NOT (!!) a flag to check if the element is actually visible to the user.
  1139. */
  1140. isShown: boolean;
  1141. /**
  1142. * Is this template a part of the HTML tree (the template manager injected it)
  1143. */
  1144. isInHtmlTree: boolean;
  1145. /**
  1146. * The HTML element containing this template
  1147. */
  1148. parent: HTMLElement;
  1149. /**
  1150. * A promise that is fulfilled when the template finished loading.
  1151. */
  1152. initPromise: Promise<Template>;
  1153. constructor(name: string, _configuration: ITemplateConfiguration);
  1154. /**
  1155. * Some templates have parameters (like background color for example).
  1156. * The parameters are provided to Handlebars which in turn generates the template.
  1157. * This function will update the template with the new parameters
  1158. *
  1159. * Note that when updating parameters the events will be registered again (after being cleared).
  1160. *
  1161. * @param params the new template parameters
  1162. */
  1163. updateParams(params: {
  1164. [key: string]: string | number | boolean | object;
  1165. }, append?: boolean): void;
  1166. redraw(): void;
  1167. /**
  1168. * Get the template'S configuration
  1169. */
  1170. readonly configuration: ITemplateConfiguration;
  1171. /**
  1172. * A template can be a parent element for other templates or HTML elements.
  1173. * This function will deliver all child HTML elements of this template.
  1174. */
  1175. getChildElements(): Array<string>;
  1176. /**
  1177. * Appending the template to a parent HTML element.
  1178. * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
  1179. * @param parent the parent to which the template is added
  1180. * @param forceRemove if the parent already exists, shoud the template be removed from it?
  1181. */
  1182. appendTo(parent: HTMLElement, forceRemove?: boolean): void;
  1183. /**
  1184. * Show the template using the provided visibilityFunction, or natively using display: flex.
  1185. * The provided function returns a promise that should be fullfilled when the element is shown.
  1186. * Since it is a promise async operations are more than possible.
  1187. * See the default viewer for an opacity example.
  1188. * @param visibilityFunction The function to execute to show the template.
  1189. */
  1190. show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1191. /**
  1192. * Hide the template using the provided visibilityFunction, or natively using display: none.
  1193. * The provided function returns a promise that should be fullfilled when the element is hidden.
  1194. * Since it is a promise async operations are more than possible.
  1195. * See the default viewer for an opacity example.
  1196. * @param visibilityFunction The function to execute to show the template.
  1197. */
  1198. hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1199. /**
  1200. * Dispose this template
  1201. */
  1202. dispose(): void;
  1203. }
  1204. }
  1205. declare module BabylonViewer {
  1206. export class ConfigurationContainer {
  1207. configuration: ViewerConfiguration;
  1208. viewerId: string;
  1209. mainColor: BABYLON.Color3;
  1210. reflectionColor: BABYLON.Color3;
  1211. scene?: BABYLON.Scene;
  1212. }
  1213. }
  1214. declare module BabylonViewer {
  1215. /**
  1216. * The configuration loader will load the configuration object from any source and will use the defined mapper to
  1217. * parse the object and return a conform ViewerConfiguration.
  1218. * It is a private member of the scene.
  1219. */
  1220. export class ConfigurationLoader {
  1221. constructor(_enableCache?: boolean);
  1222. /**
  1223. * load a configuration object that is defined in the initial configuration provided.
  1224. * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
  1225. *
  1226. * @param initConfig the initial configuration that has the definitions of further configuration to load.
  1227. * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
  1228. * @returns A promise that delivers the extended viewer configuration, when done.
  1229. */
  1230. loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
  1231. /**
  1232. * Dispose the configuration loader. This will cancel file requests, if active.
  1233. */
  1234. dispose(): void;
  1235. }
  1236. }
  1237. declare module BabylonViewer {
  1238. export class ObservablesManager {
  1239. /**
  1240. * Will notify when the scene was initialized
  1241. */
  1242. onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  1243. /**
  1244. * will notify when the engine was initialized
  1245. */
  1246. onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
  1247. /**
  1248. * Will notify when a new model was added to the scene.
  1249. * Note that added does not neccessarily mean loaded!
  1250. */
  1251. onModelAddedObservable: BABYLON.Observable<ViewerModel>;
  1252. /**
  1253. * will notify after every model load
  1254. */
  1255. onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
  1256. /**
  1257. * will notify when any model notify of progress
  1258. */
  1259. onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  1260. /**
  1261. * will notify when any model load failed.
  1262. */
  1263. onModelLoadErrorObservable: BABYLON.Observable<{
  1264. message: string;
  1265. exception: any;
  1266. }>;
  1267. /**
  1268. * Will notify when a model was removed from the scene;
  1269. */
  1270. onModelRemovedObservable: BABYLON.Observable<ViewerModel>;
  1271. /**
  1272. * will notify when a new loader was initialized.
  1273. * Used mainly to know when a model starts loading.
  1274. */
  1275. onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
  1276. /**
  1277. * Observers registered here will be executed when the entire load process has finished.
  1278. */
  1279. onViewerInitDoneObservable: BABYLON.Observable<any>;
  1280. /**
  1281. * Will notify when the viewer init started (after configuration was loaded)
  1282. */
  1283. onViewerInitStartedObservable: BABYLON.Observable<any>;
  1284. /**
  1285. * Functions added to this observable will be executed on each frame rendered.
  1286. */
  1287. onFrameRenderedObservable: BABYLON.Observable<any>;
  1288. /**
  1289. * Will notify when VR mode is entered.
  1290. */
  1291. onEnteringVRObservable: BABYLON.Observable<any>;
  1292. /**
  1293. * Will notify when VR mode is exited.
  1294. */
  1295. onExitingVRObservable: BABYLON.Observable<any>;
  1296. constructor();
  1297. dispose(): void;
  1298. }
  1299. }
  1300. declare module BabylonViewer {
  1301. }
  1302. declare module BabylonViewer {
  1303. export interface IModelConfiguration {
  1304. id?: string;
  1305. url?: string;
  1306. root?: string;
  1307. file?: string | File;
  1308. loader?: string;
  1309. position?: {
  1310. x: number;
  1311. y: number;
  1312. z: number;
  1313. };
  1314. rotation?: {
  1315. x: number;
  1316. y: number;
  1317. z: number;
  1318. w?: number;
  1319. };
  1320. scaling?: {
  1321. x: number;
  1322. y: number;
  1323. z: number;
  1324. };
  1325. parentObjectIndex?: number;
  1326. castShadow?: boolean;
  1327. receiveShadows?: boolean;
  1328. normalize?: boolean | {
  1329. center?: boolean;
  1330. unitSize?: boolean;
  1331. parentIndex?: number;
  1332. };
  1333. title?: string;
  1334. subtitle?: string;
  1335. thumbnail?: string;
  1336. animation?: {
  1337. autoStart?: boolean | string;
  1338. playOnce?: boolean;
  1339. autoStartIndex?: number;
  1340. };
  1341. entryAnimation?: IModelAnimationConfiguration;
  1342. exitAnimation?: IModelAnimationConfiguration;
  1343. material?: {
  1344. directEnabled?: boolean;
  1345. directIntensity?: number;
  1346. emissiveIntensity?: number;
  1347. environmentIntensity?: number;
  1348. [propName: string]: any;
  1349. };
  1350. /**
  1351. * Rotation offset axis definition
  1352. */
  1353. rotationOffsetAxis?: {
  1354. x: number;
  1355. y: number;
  1356. z: number;
  1357. };
  1358. /**
  1359. * the offset angle
  1360. */
  1361. rotationOffsetAngle?: number;
  1362. loaderConfiguration?: {
  1363. maxLODsToLoad?: number;
  1364. progressiveLoading?: boolean;
  1365. };
  1366. }
  1367. }
  1368. declare module BabylonViewer {
  1369. /**
  1370. * Get a loader plugin according to its name.
  1371. * The plugin will be cached and will be reused if called for again.
  1372. *
  1373. * @param name the name of the plugin
  1374. */
  1375. export function getLoaderPluginByName(name: string): ILoaderPlugin;
  1376. /**
  1377. *
  1378. */
  1379. export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
  1380. }
  1381. declare module BabylonViewer {
  1382. }
  1383. declare module BabylonViewer {
  1384. export interface IEnvironmentMapConfiguration {
  1385. /**
  1386. * Environment map texture path in relative to the asset folder.
  1387. */
  1388. texture: string;
  1389. /**
  1390. * Default rotation to apply to the environment map.
  1391. */
  1392. rotationY: number;
  1393. /**
  1394. * Tint level of the main color on the environment map.
  1395. */
  1396. tintLevel: number;
  1397. /**
  1398. * The environment's main color.
  1399. */
  1400. mainColor?: {
  1401. r?: number;
  1402. g?: number;
  1403. b?: number;
  1404. };
  1405. }
  1406. }
  1407. declare module BabylonViewer {
  1408. /**
  1409. * The EventManager is in charge of registering user interctions with the viewer.
  1410. * It is used in the TemplateManager
  1411. */
  1412. export class EventManager {
  1413. constructor(_templateManager: TemplateManager);
  1414. /**
  1415. * Register a new callback to a specific template.
  1416. * The best example for the usage can be found in the DefaultViewer
  1417. *
  1418. * @param templateName the templateName to register the event to
  1419. * @param callback The callback to be executed
  1420. * @param eventType the type of event to register
  1421. * @param selector an optional selector. if not defined the parent object in the template will be selected
  1422. */
  1423. registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1424. /**
  1425. * This will remove a registered event from the defined template.
  1426. * Each one of the variables apart from the template name are optional, but one must be provided.
  1427. *
  1428. * @param templateName the templateName
  1429. * @param callback the callback to remove (optional)
  1430. * @param eventType the event type to remove (optional)
  1431. * @param selector the selector from which to remove the event (optional)
  1432. */
  1433. unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1434. /**
  1435. * Dispose the event manager
  1436. */
  1437. dispose(): void;
  1438. }
  1439. }
  1440. declare module BabylonViewer {
  1441. /**
  1442. * Defines an animation to be applied to a model (translation, scale or rotation).
  1443. */
  1444. export interface IModelAnimationConfiguration {
  1445. /**
  1446. * Time of animation, in seconds
  1447. */
  1448. time?: number;
  1449. /**
  1450. * Scale to apply
  1451. */
  1452. scaling?: {
  1453. x: number;
  1454. y: number;
  1455. z: number;
  1456. };
  1457. /**
  1458. * Easing function to apply
  1459. */
  1460. easingFunction?: number;
  1461. /**
  1462. * An Easing mode to apply to the easing function
  1463. * See BABYLON.EasingFunction
  1464. */
  1465. easingMode?: number;
  1466. }
  1467. }
  1468. declare module BabylonViewer {
  1469. export class TelemetryLoaderPlugin implements ILoaderPlugin {
  1470. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1471. onLoaded(model: ViewerModel): void;
  1472. onError(message: string, exception: any): void;
  1473. onComplete(): void;
  1474. }
  1475. }
  1476. declare module BabylonViewer {
  1477. /**
  1478. * A loder plugin to use MSFT_lod extension correctly (glTF)
  1479. */
  1480. export class MSFTLodLoaderPlugin implements ILoaderPlugin {
  1481. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1482. onExtensionLoaded(extension: BABYLON.IGLTFLoaderExtension): void;
  1483. }
  1484. }
  1485. declare module BabylonViewer {
  1486. /**
  1487. * Force-apply material configuration right after a material was loaded.
  1488. */
  1489. export class ApplyMaterialConfigPlugin implements ILoaderPlugin {
  1490. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1491. onMaterialLoaded(material: BABYLON.Material): void;
  1492. }
  1493. }
  1494. declare module BabylonViewer {
  1495. /**
  1496. * A (PBR) material will be extended using this function.
  1497. * This function will hold extra default configuration for the viewer, if not implemented in Babylon itself.
  1498. */
  1499. export class ExtendedMaterialLoaderPlugin implements ILoaderPlugin {
  1500. onMaterialLoaded(baseMaterial: BABYLON.Material): void;
  1501. }
  1502. }
  1503. declare module BabylonViewer {
  1504. export interface ICameraConfiguration {
  1505. position?: {
  1506. x: number;
  1507. y: number;
  1508. z: number;
  1509. };
  1510. rotation?: {
  1511. x: number;
  1512. y: number;
  1513. z: number;
  1514. w: number;
  1515. };
  1516. fov?: number;
  1517. fovMode?: number;
  1518. minZ?: number;
  1519. maxZ?: number;
  1520. inertia?: number;
  1521. exposure?: number;
  1522. pinchPrecision?: number;
  1523. behaviors?: {
  1524. [name: string]: boolean | number | ICameraBehaviorConfiguration;
  1525. };
  1526. disableCameraControl?: boolean;
  1527. disableCtrlForPanning?: boolean;
  1528. disableAutoFocus?: boolean;
  1529. [propName: string]: any;
  1530. }
  1531. export interface ICameraBehaviorConfiguration {
  1532. type: number;
  1533. [propName: string]: any;
  1534. }
  1535. }
  1536. declare module BabylonViewer {
  1537. /**
  1538. * The Color Grading Configuration groups the different settings used to define the color grading used in the viewer.
  1539. */
  1540. export interface IColorGradingConfiguration {
  1541. /**
  1542. * Transform data string, encoded as determined by transformDataFormat.
  1543. */
  1544. transformData: string;
  1545. /**
  1546. * The encoding format of TransformData (currently only raw-base16 is supported).
  1547. */
  1548. transformDataFormat: string;
  1549. /**
  1550. * The weight of the transform
  1551. */
  1552. transformWeight: number;
  1553. /**
  1554. * Color curve colorFilterHueGlobal value
  1555. */
  1556. colorFilterHueGlobal: number;
  1557. /**
  1558. * Color curve colorFilterHueShadows value
  1559. */
  1560. colorFilterHueShadows: number;
  1561. /**
  1562. * Color curve colorFilterHueMidtones value
  1563. */
  1564. colorFilterHueMidtones: number;
  1565. /**
  1566. * Color curve colorFilterHueHighlights value
  1567. */
  1568. colorFilterHueHighlights: number;
  1569. /**
  1570. * Color curve colorFilterDensityGlobal value
  1571. */
  1572. colorFilterDensityGlobal: number;
  1573. /**
  1574. * Color curve colorFilterDensityShadows value
  1575. */
  1576. colorFilterDensityShadows: number;
  1577. /**
  1578. * Color curve colorFilterDensityMidtones value
  1579. */
  1580. colorFilterDensityMidtones: number;
  1581. /**
  1582. * Color curve colorFilterDensityHighlights value
  1583. */
  1584. colorFilterDensityHighlights: number;
  1585. /**
  1586. * Color curve saturationGlobal value
  1587. */
  1588. saturationGlobal: number;
  1589. /**
  1590. * Color curve saturationShadows value
  1591. */
  1592. saturationShadows: number;
  1593. /**
  1594. * Color curve saturationMidtones value
  1595. */
  1596. saturationMidtones: number;
  1597. /**
  1598. * Color curve saturationHighlights value
  1599. */
  1600. saturationHighlights: number;
  1601. /**
  1602. * Color curve exposureGlobal value
  1603. */
  1604. exposureGlobal: number;
  1605. /**
  1606. * Color curve exposureShadows value
  1607. */
  1608. exposureShadows: number;
  1609. /**
  1610. * Color curve exposureMidtones value
  1611. */
  1612. exposureMidtones: number;
  1613. /**
  1614. * Color curve exposureHighlights value
  1615. */
  1616. exposureHighlights: number;
  1617. }
  1618. }
  1619. declare module BabylonViewer {
  1620. export interface IDefaultRenderingPipelineConfiguration {
  1621. sharpenEnabled?: boolean;
  1622. bloomEnabled?: boolean;
  1623. bloomThreshold?: number;
  1624. depthOfFieldEnabled?: boolean;
  1625. depthOfFieldBlurLevel?: BABYLON.DepthOfFieldEffectBlurLevel;
  1626. fxaaEnabled?: boolean;
  1627. imageProcessingEnabled?: boolean;
  1628. defaultPipelineTextureType?: number;
  1629. bloomScale?: number;
  1630. chromaticAberrationEnabled?: boolean;
  1631. grainEnabled?: boolean;
  1632. bloomKernel?: number;
  1633. hardwareScaleLevel?: number;
  1634. bloomWeight?: number;
  1635. hdr?: boolean;
  1636. samples?: number;
  1637. glowLayerEnabled?: boolean;
  1638. }
  1639. }
  1640. declare module BabylonViewer {
  1641. export interface IGroundConfiguration {
  1642. size?: number;
  1643. receiveShadows?: boolean;
  1644. shadowLevel?: number;
  1645. shadowOnly?: boolean;
  1646. mirror?: boolean | {
  1647. sizeRatio?: number;
  1648. blurKernel?: number;
  1649. amount?: number;
  1650. fresnelWeight?: number;
  1651. fallOffDistance?: number;
  1652. textureType?: number;
  1653. };
  1654. texture?: string;
  1655. color?: {
  1656. r: number;
  1657. g: number;
  1658. b: number;
  1659. };
  1660. opacity?: number;
  1661. material?: {
  1662. [propName: string]: any;
  1663. };
  1664. }
  1665. }
  1666. declare module BabylonViewer {
  1667. export interface IImageProcessingConfiguration {
  1668. colorGradingEnabled?: boolean;
  1669. colorCurvesEnabled?: boolean;
  1670. colorCurves?: {
  1671. globalHue?: number;
  1672. globalDensity?: number;
  1673. globalSaturation?: number;
  1674. globalExposure?: number;
  1675. highlightsHue?: number;
  1676. highlightsDensity?: number;
  1677. highlightsSaturation?: number;
  1678. highlightsExposure?: number;
  1679. midtonesHue?: number;
  1680. midtonesDensity?: number;
  1681. midtonesSaturation?: number;
  1682. midtonesExposure?: number;
  1683. shadowsHue?: number;
  1684. shadowsDensity?: number;
  1685. shadowsSaturation?: number;
  1686. shadowsExposure?: number;
  1687. };
  1688. colorGradingWithGreenDepth?: boolean;
  1689. colorGradingBGR?: boolean;
  1690. exposure?: number;
  1691. toneMappingEnabled?: boolean;
  1692. contrast?: number;
  1693. vignetteEnabled?: boolean;
  1694. vignetteStretch?: number;
  1695. vignetteCentreX?: number;
  1696. vignetteCentreY?: number;
  1697. vignetteWeight?: number;
  1698. vignetteColor?: {
  1699. r: number;
  1700. g: number;
  1701. b: number;
  1702. a?: number;
  1703. };
  1704. vignetteCameraFov?: number;
  1705. vignetteBlendMode?: number;
  1706. vignetteM?: boolean;
  1707. applyByPostProcess?: boolean;
  1708. isEnabled?: boolean;
  1709. }
  1710. }
  1711. declare module BabylonViewer {
  1712. export interface ILightConfiguration {
  1713. type: number;
  1714. name?: string;
  1715. disabled?: boolean;
  1716. position?: {
  1717. x: number;
  1718. y: number;
  1719. z: number;
  1720. };
  1721. target?: {
  1722. x: number;
  1723. y: number;
  1724. z: number;
  1725. };
  1726. direction?: {
  1727. x: number;
  1728. y: number;
  1729. z: number;
  1730. };
  1731. diffuse?: {
  1732. r: number;
  1733. g: number;
  1734. b: number;
  1735. };
  1736. specular?: {
  1737. r: number;
  1738. g: number;
  1739. b: number;
  1740. };
  1741. intensity?: number;
  1742. intensityMode?: number;
  1743. radius?: number;
  1744. shadownEnabled?: boolean;
  1745. shadowConfig?: {
  1746. useBlurExponentialShadowMap?: boolean;
  1747. useBlurCloseExponentialShadowMap?: boolean;
  1748. useKernelBlur?: boolean;
  1749. blurKernel?: number;
  1750. blurScale?: number;
  1751. minZ?: number;
  1752. maxZ?: number;
  1753. frustumSize?: number;
  1754. angleScale?: number;
  1755. frustumEdgeFalloff?: number;
  1756. [propName: string]: any;
  1757. };
  1758. spotAngle?: number;
  1759. shadowFieldOfView?: number;
  1760. shadowBufferSize?: number;
  1761. shadowFrustumSize?: number;
  1762. shadowMinZ?: number;
  1763. shadowMaxZ?: number;
  1764. [propName: string]: any;
  1765. behaviors?: {
  1766. [name: string]: number | {
  1767. type: number;
  1768. [propName: string]: any;
  1769. };
  1770. };
  1771. }
  1772. }
  1773. declare module BabylonViewer {
  1774. export interface IObserversConfiguration {
  1775. onEngineInit?: string;
  1776. onSceneInit?: string;
  1777. onModelLoaded?: string;
  1778. }
  1779. }
  1780. declare module BabylonViewer {
  1781. export interface ISceneConfiguration {
  1782. debug?: boolean;
  1783. clearColor?: {
  1784. r: number;
  1785. g: number;
  1786. b: number;
  1787. a: number;
  1788. };
  1789. /** Deprecated, use environmentMap.mainColor instead. */
  1790. mainColor?: {
  1791. r?: number;
  1792. g?: number;
  1793. b?: number;
  1794. };
  1795. imageProcessingConfiguration?: IImageProcessingConfiguration;
  1796. environmentTexture?: string;
  1797. colorGrading?: IColorGradingConfiguration;
  1798. environmentRotationY?: number;
  1799. /**
  1800. * Deprecated, please use default rendering pipeline
  1801. */
  1802. glow?: boolean | BABYLON.IGlowLayerOptions;
  1803. disableHdr?: boolean;
  1804. renderInBackground?: boolean;
  1805. disableCameraControl?: boolean;
  1806. animationPropertiesOverride?: {
  1807. [propName: string]: any;
  1808. };
  1809. defaultMaterial?: {
  1810. materialType: "standard" | "pbr";
  1811. [propName: string]: any;
  1812. };
  1813. flags?: {
  1814. shadowsEnabled?: boolean;
  1815. particlesEnabled?: boolean;
  1816. collisionsEnabled?: boolean;
  1817. lightsEnabled?: boolean;
  1818. texturesEnabled?: boolean;
  1819. lensFlaresEnabled?: boolean;
  1820. proceduralTexturesEnabled?: boolean;
  1821. renderTargetsEnabled?: boolean;
  1822. spritesEnabled?: boolean;
  1823. skeletonsEnabled?: boolean;
  1824. audioEnabled?: boolean;
  1825. };
  1826. assetsRootURL?: string;
  1827. }
  1828. }
  1829. declare module BabylonViewer {
  1830. export interface ISceneOptimizerConfiguration {
  1831. targetFrameRate?: number;
  1832. trackerDuration?: number;
  1833. autoGeneratePriorities?: boolean;
  1834. improvementMode?: boolean;
  1835. degradation?: string;
  1836. types?: {
  1837. texture?: ISceneOptimizerParameters;
  1838. hardwareScaling?: ISceneOptimizerParameters;
  1839. shadow?: ISceneOptimizerParameters;
  1840. postProcess?: ISceneOptimizerParameters;
  1841. lensFlare?: ISceneOptimizerParameters;
  1842. particles?: ISceneOptimizerParameters;
  1843. renderTarget?: ISceneOptimizerParameters;
  1844. mergeMeshes?: ISceneOptimizerParameters;
  1845. };
  1846. custom?: string;
  1847. }
  1848. export interface ISceneOptimizerParameters {
  1849. priority?: number;
  1850. maximumSize?: number;
  1851. step?: number;
  1852. }
  1853. }
  1854. declare module BabylonViewer {
  1855. export interface ISkyboxConfiguration {
  1856. cubeTexture?: {
  1857. noMipMap?: boolean;
  1858. gammaSpace?: boolean;
  1859. url?: string | Array<string>;
  1860. };
  1861. color?: {
  1862. r: number;
  1863. g: number;
  1864. b: number;
  1865. };
  1866. pbr?: boolean;
  1867. scale?: number;
  1868. blur?: number;
  1869. material?: {
  1870. imageProcessingConfiguration?: IImageProcessingConfiguration;
  1871. [propName: string]: any;
  1872. };
  1873. infiniteDistance?: boolean;
  1874. }
  1875. }
  1876. declare module BabylonViewer {
  1877. /**
  1878. * A single template configuration object
  1879. */
  1880. export interface ITemplateConfiguration {
  1881. /**
  1882. * can be either the id of the template's html element or a URL.
  1883. * See - http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
  1884. */
  1885. location?: string;
  1886. /**
  1887. * If no location is provided you can provide here the raw html of this template.
  1888. * See http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
  1889. */
  1890. html?: string;
  1891. id?: string;
  1892. /**
  1893. * Parameters that will be delivered to the template and will render it accordingly.
  1894. */
  1895. params?: {
  1896. [key: string]: string | number | boolean | object;
  1897. };
  1898. /**
  1899. * Events to attach to this template.
  1900. * event name is the key. the value can either be a boolean (attach to the parent element)
  1901. * or a map of html id elements.
  1902. *
  1903. * See - http://doc.babylonjs.com/extensions/the_templating_system#event-binding
  1904. */
  1905. events?: {
  1906. pointerdown?: boolean | {
  1907. [id: string]: boolean;
  1908. };
  1909. pointerup?: boolean | {
  1910. [id: string]: boolean;
  1911. };
  1912. pointermove?: boolean | {
  1913. [id: string]: boolean;
  1914. };
  1915. pointerover?: boolean | {
  1916. [id: string]: boolean;
  1917. };
  1918. pointerout?: boolean | {
  1919. [id: string]: boolean;
  1920. };
  1921. pointerenter?: boolean | {
  1922. [id: string]: boolean;
  1923. };
  1924. pointerleave?: boolean | {
  1925. [id: string]: boolean;
  1926. };
  1927. pointercancel?: boolean | {
  1928. [id: string]: boolean;
  1929. };
  1930. click?: boolean | {
  1931. [id: string]: boolean;
  1932. };
  1933. dragstart?: boolean | {
  1934. [id: string]: boolean;
  1935. };
  1936. drop?: boolean | {
  1937. [id: string]: boolean;
  1938. };
  1939. [key: string]: boolean | {
  1940. [id: string]: boolean;
  1941. } | undefined;
  1942. };
  1943. }
  1944. }
  1945. declare module BabylonViewer {
  1946. export interface IVRConfiguration {
  1947. disabled?: boolean;
  1948. objectScaleFactor?: number;
  1949. disableInteractions?: boolean;
  1950. disableTeleportation?: boolean;
  1951. overrideFloorMeshName?: string;
  1952. vrOptions?: BABYLON.VRExperienceHelperOptions;
  1953. modelHeightCorrection?: number | boolean;
  1954. rotateUsingControllers?: boolean;
  1955. cameraPosition?: {
  1956. x: number;
  1957. y: number;
  1958. z: number;
  1959. };
  1960. }
  1961. }