babylon.viewer.d.ts 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479
  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. /// <reference path="./babylon.d.ts"/>
  6. /// <reference path="./babylon.glTF2Interface.d.ts"/>
  7. /// <reference path="./babylonjs.loaders.d.ts"/>
  8. declare module "babylonjs-loaders"{ export=BABYLON;}
  9. // Generated by dts-bundle v0.7.3
  10. // Dependencies for this module:
  11. // ../../../../../Tools/gulp/babylonjs
  12. // ../../../../../Tools/gulp/babylonjs-loaders
  13. declare module BabylonViewer {
  14. /**
  15. * BabylonJS Viewer
  16. *
  17. * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions.
  18. */
  19. let disableInit: boolean;
  20. /**
  21. * Dispose all viewers currently registered
  22. */
  23. function disposeAll(): void;
  24. const Version: string;
  25. }
  26. declare module BabylonViewer {
  27. /**
  28. * This is the mapper's interface. Implement this function to create your own mapper and register it at the mapper manager
  29. */
  30. export interface IMapper {
  31. map(rawSource: any): ViewerConfiguration;
  32. }
  33. /**
  34. * The MapperManager manages the different implemented mappers.
  35. * It allows the user to register new mappers as well and use them to parse their own configuration data
  36. */
  37. export class MapperManager {
  38. /**
  39. * The default mapper is the JSON mapper.
  40. */
  41. static DefaultMapper: string;
  42. constructor();
  43. /**
  44. * Get a specific configuration mapper.
  45. *
  46. * @param type the name of the mapper to load
  47. */
  48. getMapper(type: string): IMapper;
  49. /**
  50. * Use this functio to register your own configuration mapper.
  51. * After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.
  52. * @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper
  53. * @param mapper The implemented mapper
  54. */
  55. registerMapper(type: string, mapper: IMapper): void;
  56. /**
  57. * Dispose the mapper manager and all of its mappers.
  58. */
  59. dispose(): void;
  60. }
  61. /**
  62. * mapperManager is a singleton of the type MapperManager.
  63. * The mapperManager can be disposed directly with calling mapperManager.dispose()
  64. * or indirectly with using BabylonViewer.disposeAll()
  65. */
  66. export let mapperManager: MapperManager;
  67. }
  68. declare module BabylonViewer {
  69. export class ViewerGlobals {
  70. disableInit: boolean;
  71. disableWebGL2Support: boolean;
  72. readonly version: string;
  73. }
  74. export let viewerGlobals: ViewerGlobals;
  75. }
  76. declare module BabylonViewer {
  77. /**
  78. * The viewer manager is the container for all viewers currently registered on this page.
  79. * It is possible to have more than one viewer on a single page.
  80. */
  81. export class ViewerManager {
  82. /**
  83. * A callback that will be triggered when a new viewer was added
  84. */
  85. onViewerAdded: (viewer: AbstractViewer) => void;
  86. /**
  87. * Will notify when a new viewer was added
  88. */
  89. onViewerAddedObservable: BABYLON.Observable<AbstractViewer>;
  90. /**
  91. * Will notify when a viewer was removed (disposed)
  92. */
  93. onViewerRemovedObservable: BABYLON.Observable<string>;
  94. constructor();
  95. /**
  96. * Adding a new viewer to the viewer manager and start tracking it.
  97. * @param viewer the viewer to add
  98. */
  99. addViewer(viewer: AbstractViewer): void;
  100. /**
  101. * remove a viewer from the viewer manager
  102. * @param viewer the viewer to remove
  103. */
  104. removeViewer(viewer: AbstractViewer): void;
  105. /**
  106. * 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)
  107. * @param id the id of the HTMl element (or the viewer's, if none provided)
  108. */
  109. getViewerById(id: string): AbstractViewer;
  110. /**
  111. * Get a viewer using a container element
  112. * @param element the HTML element to search viewers associated with
  113. */
  114. getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
  115. /**
  116. * Get a promise that will fullfil when this viewer was initialized.
  117. * Since viewer initialization and template injection is asynchronous, using the promise will guaranty that
  118. * you will get the viewer after everything was already configured.
  119. * @param id the viewer id to find
  120. */
  121. getViewerPromiseById(id: string): Promise<AbstractViewer>;
  122. /**
  123. * dispose the manager and all of its associated viewers
  124. */
  125. dispose(): void;
  126. }
  127. export let viewerManager: ViewerManager;
  128. }
  129. declare module BabylonViewer {
  130. /**
  131. * The Default viewer is the default implementation of the AbstractViewer.
  132. * It uses the templating system to render a new canvas and controls.
  133. */
  134. export class DefaultViewer extends AbstractViewer {
  135. containerElement: Element;
  136. fullscreenElement?: Element;
  137. /**
  138. * Create a new default viewer
  139. * @param containerElement the element in which the templates will be rendered
  140. * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
  141. */
  142. constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
  143. registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
  144. /**
  145. * This will be executed when the templates initialize.
  146. */
  147. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  148. protected _initVR(): void;
  149. /**
  150. * Toggle fullscreen of the entire viewer
  151. */
  152. toggleFullscreen: () => void;
  153. /**
  154. * Preparing the container element to present the viewer
  155. */
  156. protected _prepareContainerElement(): void;
  157. /**
  158. * This function will configure the templates and update them after a model was loaded
  159. * It is mainly responsible to changing the title and subtitle etc'.
  160. * @param model the model to be used to configure the templates by
  161. */
  162. protected _configureTemplate(model?: ViewerModel): void;
  163. /**
  164. * This will load a new model to the default viewer
  165. * overriding the AbstractViewer's loadModel.
  166. * The scene will automatically be cleared of the old models, if exist.
  167. * @param model the configuration object (or URL) to load.
  168. */
  169. loadModel(model?: string | File | IModelConfiguration): Promise<ViewerModel>;
  170. /**
  171. * Show the overlay and the defined sub-screen.
  172. * Mainly used for help and errors
  173. * @param subScreen the name of the subScreen. Those can be defined in the configuration object
  174. */
  175. showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
  176. /**
  177. * Hide the overlay screen.
  178. */
  179. hideOverlayScreen(): Promise<string> | Promise<Template>;
  180. /**
  181. * show the viewer (in case it was hidden)
  182. *
  183. * @param visibilityFunction an optional function to execute in order to show the container
  184. */
  185. show(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
  186. /**
  187. * hide the viewer (in case it is visible)
  188. *
  189. * @param visibilityFunction an optional function to execute in order to hide the container
  190. */
  191. hide(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
  192. /**
  193. * Show the loading screen.
  194. * The loading screen can be configured using the configuration object
  195. */
  196. showLoadingScreen(): Promise<string> | Promise<Template>;
  197. /**
  198. * Hide the loading screen
  199. */
  200. hideLoadingScreen(): Promise<string> | Promise<Template>;
  201. dispose(): void;
  202. protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
  203. }
  204. }
  205. declare module BabylonViewer {
  206. /**
  207. * The AbstractViewer is the center of Babylon's viewer.
  208. * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
  209. */
  210. export abstract class AbstractViewer {
  211. containerElement: Element;
  212. /**
  213. * The corresponsing template manager of this viewer.
  214. */
  215. templateManager: TemplateManager;
  216. /**
  217. * Babylon BABYLON.Engine corresponding with this viewer
  218. */
  219. engine: BABYLON.Engine;
  220. /**
  221. * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
  222. */
  223. readonly baseId: string;
  224. /**
  225. * The last loader used to load a model.
  226. * @deprecated
  227. */
  228. lastUsedLoader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
  229. /**
  230. * The ModelLoader instance connected with this viewer.
  231. */
  232. modelLoader: ModelLoader;
  233. /**
  234. * A flag that controls whether or not the render loop should be executed
  235. */
  236. runRenderLoop: boolean;
  237. /**
  238. * The scene manager connected with this viewer instance
  239. */
  240. sceneManager: SceneManager;
  241. /**
  242. * Will notify when the scene was initialized
  243. */
  244. readonly onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  245. /**
  246. * will notify when the engine was initialized
  247. */
  248. readonly onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
  249. /**
  250. * Will notify when a new model was added to the scene.
  251. * Note that added does not neccessarily mean loaded!
  252. */
  253. readonly onModelAddedObservable: BABYLON.Observable<ViewerModel>;
  254. /**
  255. * will notify after every model load
  256. */
  257. readonly onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
  258. /**
  259. * will notify when any model notify of progress
  260. */
  261. readonly onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  262. /**
  263. * will notify when any model load failed.
  264. */
  265. readonly onModelLoadErrorObservable: BABYLON.Observable<{
  266. message: string;
  267. exception: any;
  268. }>;
  269. /**
  270. * Will notify when a model was removed from the scene;
  271. */
  272. readonly onModelRemovedObservable: BABYLON.Observable<ViewerModel>;
  273. /**
  274. * will notify when a new loader was initialized.
  275. * Used mainly to know when a model starts loading.
  276. */
  277. readonly onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
  278. /**
  279. * Observers registered here will be executed when the entire load process has finished.
  280. */
  281. readonly onInitDoneObservable: BABYLON.Observable<AbstractViewer>;
  282. /**
  283. * Functions added to this observable will be executed on each frame rendered.
  284. */
  285. readonly onFrameRenderedObservable: BABYLON.Observable<AbstractViewer>;
  286. /**
  287. * Observers registered here will be executed when VR more is entered.
  288. */
  289. readonly onEnteringVRObservable: BABYLON.Observable<AbstractViewer>;
  290. /**
  291. * Observers registered here will be executed when VR mode is exited.
  292. */
  293. readonly onExitingVRObservable: BABYLON.Observable<AbstractViewer>;
  294. observablesManager: ObservablesManager;
  295. /**
  296. * The canvas associated with this viewer
  297. */
  298. protected _canvas: HTMLCanvasElement;
  299. /**
  300. * The (single) canvas of this viewer
  301. */
  302. readonly canvas: HTMLCanvasElement;
  303. /**
  304. * is this viewer disposed?
  305. */
  306. protected _isDisposed: boolean;
  307. /**
  308. * registered onBeforeRender functions.
  309. * This functions are also registered at the native scene. The reference can be used to unregister them.
  310. */
  311. protected _registeredOnBeforeRenderFunctions: Array<() => void>;
  312. /**
  313. * The configuration loader of this viewer
  314. */
  315. protected _configurationLoader: ConfigurationLoader;
  316. /**
  317. * Is the viewer already initialized. for internal use.
  318. */
  319. protected _isInit: boolean;
  320. protected _configurationContainer: ConfigurationContainer;
  321. readonly configurationContainer: ConfigurationContainer;
  322. constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
  323. /**
  324. * get the baseId of this viewer
  325. */
  326. getBaseId(): string;
  327. /**
  328. * Do we have a canvas to render on, and is it a part of the scene
  329. */
  330. isCanvasInDOM(): boolean;
  331. /**
  332. * Set the viewer's background rendering flag.
  333. */
  334. renderInBackground: boolean;
  335. /**
  336. * Get the configuration object. This is a reference only.
  337. * The configuration can ONLY be updated using the updateConfiguration function.
  338. * changing this object will have no direct effect on the scene.
  339. */
  340. readonly configuration: ViewerConfiguration;
  341. /**
  342. * force resizing the engine.
  343. */
  344. forceResize(): void;
  345. protected _hdToggled: boolean;
  346. toggleHD(): void;
  347. protected _vrToggled: boolean;
  348. protected _vrScale: number;
  349. protected _vrInit: boolean;
  350. toggleVR(): void;
  351. protected _initVR(): void;
  352. /**
  353. * The resize function that will be registered with the window object
  354. */
  355. protected _resize: () => void;
  356. protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
  357. /**
  358. * Force a single render loop execution.
  359. */
  360. forceRender(): void;
  361. /**
  362. * render loop that will be executed by the engine
  363. */
  364. protected _render: (force?: boolean) => void;
  365. /**
  366. * Takes a screenshot of the scene and returns it as a base64 encoded png.
  367. * @param callback optional callback that will be triggered when screenshot is done.
  368. * @param width Optional screenshot width (default to 512).
  369. * @param height Optional screenshot height (default to 512).
  370. * @returns a promise with the screenshot data
  371. */
  372. takeScreenshot(callback?: (data: string) => void, width?: number, height?: number): Promise<string>;
  373. /**
  374. * Update the current viewer configuration with new values.
  375. * Only provided information will be updated, old configuration values will be kept.
  376. * If this.configuration was manually changed, you can trigger this function with no parameters,
  377. * and the entire configuration will be updated.
  378. * @param newConfiguration the partial configuration to update or a URL to a JSON holding the updated configuration
  379. *
  380. */
  381. updateConfiguration(newConfiguration?: Partial<ViewerConfiguration> | string): void;
  382. /**
  383. * this is used to register native functions using the configuration object.
  384. * This will configure the observers.
  385. * @param observersConfiguration observers configuration
  386. */
  387. protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
  388. /**
  389. * Dispose the entire viewer including the scene and the engine
  390. */
  391. dispose(): void;
  392. /**
  393. * This will prepare the container element for the viewer
  394. */
  395. protected abstract _prepareContainerElement(): any;
  396. /**
  397. * This function will execute when the HTML templates finished initializing.
  398. * It should initialize the engine and continue execution.
  399. *
  400. * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
  401. */
  402. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  403. /**
  404. * This will force the creation of an engine and a scene.
  405. * It will also load a model if preconfigured.
  406. * But first - it will load the extendible onTemplateLoaded()!
  407. */
  408. protected _onTemplateLoaded(): Promise<AbstractViewer>;
  409. /**
  410. * Initialize the engine. Retruns a promise in case async calls are needed.
  411. *
  412. * @protected
  413. * @returns {Promise<BABYLON.Engine>}
  414. * @memberof Viewer
  415. */
  416. protected _initEngine(): Promise<BABYLON.Engine>;
  417. /**
  418. * Initialize a model loading. The returned object (a ViewerModel object) will be loaded in the background.
  419. * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
  420. *
  421. * @param modelConfig model configuration to use when loading the model.
  422. * @param clearScene should the scene be cleared before loading this model
  423. * @returns a ViewerModel object that is not yet fully loaded.
  424. */
  425. initModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): ViewerModel;
  426. /**
  427. * load a model using the provided configuration.
  428. * This function, as opposed to initModel, will return a promise that resolves when the model is loaded, and rejects with error.
  429. * If you want to attach to the observables of the model, use initModle instead.
  430. *
  431. * @param modelConfig the model configuration or URL to load.
  432. * @param clearScene Should the scene be cleared before loading the model
  433. * @returns a Promise the fulfills when the model finished loading successfully.
  434. */
  435. loadModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): Promise<ViewerModel>;
  436. protected _initTelemetryEvents(): void;
  437. /**
  438. * Injects all the spectre shader in the babylon shader store
  439. */
  440. protected _injectCustomShaders(): void;
  441. }
  442. }
  443. declare module BabylonViewer {
  444. /**
  445. * The data structure of a telemetry event.
  446. */
  447. export interface TelemetryData {
  448. event: string;
  449. session: string;
  450. date: Date;
  451. now: number;
  452. viewerId?: string;
  453. detail: any;
  454. }
  455. /**
  456. * Receives Telemetry events and raises events to the API
  457. */
  458. export class TelemetryManager {
  459. onEventBroadcastedObservable: BABYLON.Observable<TelemetryData>;
  460. /**
  461. * Receives a telemetry event
  462. * @param event The name of the Telemetry event
  463. * @param details An additional value, or an object containing a list of property/value pairs
  464. */
  465. readonly broadcast: (event: string, viewerId?: string | undefined, details?: any) => void;
  466. /**
  467. * Log a Telemetry event for errors raised on the WebGL context.
  468. * @param engine The Babylon engine with the WebGL context.
  469. */
  470. flushWebGLErrors(engine: BABYLON.Engine, viewerId?: string): void;
  471. /**
  472. * Enable or disable telemetry events
  473. * @param enabled Boolan, true if events are enabled
  474. */
  475. enable: boolean;
  476. /**
  477. * Returns the current session ID or creates one if it doesn't exixt
  478. * @return The current session ID
  479. */
  480. readonly session: string;
  481. /**
  482. * Disposes the telemetry manager
  483. */
  484. dispose(): void;
  485. }
  486. export const telemetryManager: TelemetryManager;
  487. }
  488. declare module BabylonViewer {
  489. /**
  490. * An instance of the class is in charge of loading the model correctly.
  491. * This class will continously be expended with tasks required from the specific loaders Babylon has.
  492. *
  493. * A Model loader is unique per (Abstract)Viewer. It is being generated by the viewer
  494. */
  495. export class ModelLoader {
  496. readonly baseUrl: string;
  497. /**
  498. * Create a new Model loader
  499. * @param _viewer the viewer using this model loader
  500. */
  501. constructor(_observablesManager: ObservablesManager, _configurationContainer?: ConfigurationContainer | undefined);
  502. /**
  503. * Adds a new plugin to the loader process.
  504. *
  505. * @param plugin the plugin name or the plugin itself
  506. */
  507. addPlugin(plugin: ILoaderPlugin | string): void;
  508. /**
  509. * Load a model using predefined configuration
  510. * @param modelConfiguration the modelConfiguration to use to load the model
  511. */
  512. load(modelConfiguration: IModelConfiguration): ViewerModel;
  513. cancelLoad(model: ViewerModel): void;
  514. /**
  515. * dispose the model loader.
  516. * If loaders are registered and are in the middle of loading, they will be disposed and the request(s) will be cancelled.
  517. */
  518. dispose(): void;
  519. }
  520. }
  521. declare module BabylonViewer {
  522. /**
  523. * The current state of the model
  524. */
  525. export enum ModelState {
  526. INIT = 0,
  527. LOADING = 1,
  528. LOADED = 2,
  529. ENTRY = 3,
  530. ENTRYDONE = 4,
  531. COMPLETE = 5,
  532. CANCELED = 6,
  533. ERROR = 7
  534. }
  535. /**
  536. * The viewer model is a container for all assets representing a sngle loaded model.
  537. */
  538. export class ViewerModel implements BABYLON.IDisposable {
  539. /**
  540. * The loader used to load this model.
  541. */
  542. loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
  543. /**
  544. * This model's root mesh (the parent of all other meshes).
  545. * This mesh does not(!) exist in the meshes array.
  546. */
  547. rootMesh: BABYLON.AbstractMesh;
  548. /**
  549. * ParticleSystems connected to this model
  550. */
  551. particleSystems: Array<BABYLON.IParticleSystem>;
  552. /**
  553. * Skeletons defined in this model
  554. */
  555. skeletons: Array<BABYLON.Skeleton>;
  556. /**
  557. * The current model animation.
  558. * On init, this will be undefined.
  559. */
  560. currentAnimation: IModelAnimation;
  561. /**
  562. * Observers registered here will be executed when the model is done loading
  563. */
  564. onLoadedObservable: BABYLON.Observable<ViewerModel>;
  565. /**
  566. * Observers registered here will be executed when the loader notified of a progress event
  567. */
  568. onLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  569. /**
  570. * Observers registered here will be executed when the loader notified of an error.
  571. */
  572. onLoadErrorObservable: BABYLON.Observable<{
  573. message: string;
  574. exception: any;
  575. }>;
  576. /**
  577. * Will be executed after the model finished loading and complete, including entry animation and lod
  578. */
  579. onCompleteObservable: BABYLON.Observable<ViewerModel>;
  580. /**
  581. * Observers registered here will be executed every time the model is being configured.
  582. * This can be used to extend the model's configuration without extending the class itself
  583. */
  584. onAfterConfigure: BABYLON.Observable<ViewerModel>;
  585. /**
  586. * The current model state (loaded, error, etc)
  587. */
  588. state: ModelState;
  589. /**
  590. * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
  591. */
  592. loadId: number;
  593. loadInfo: BABYLON.GLTF2.IAsset;
  594. constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
  595. shadowsRenderedAfterLoad: boolean;
  596. getViewerId(): string | undefined;
  597. /**
  598. * Set whether this model is enabled or not.
  599. */
  600. enabled: boolean;
  601. loaderDone: boolean;
  602. /**
  603. * Add a mesh to this model.
  604. * Any mesh that has no parent will be provided with the root mesh as its new parent.
  605. *
  606. * @param mesh the new mesh to add
  607. * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
  608. */
  609. addMesh(mesh: BABYLON.AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
  610. /**
  611. * get the list of meshes (excluding the root mesh)
  612. */
  613. readonly meshes: BABYLON.AbstractMesh[];
  614. /**
  615. * (Re-)set the model's entire configuration
  616. * @param newConfiguration the new configuration to replace the new one
  617. */
  618. configuration: IModelConfiguration;
  619. /**
  620. * Update the current configuration with new values.
  621. * Configuration will not be overwritten, but merged with the new configuration.
  622. * Priority is to the new configuration
  623. * @param newConfiguration the configuration to be merged into the current configuration;
  624. */
  625. updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
  626. /**
  627. * Add a new animation group to this model.
  628. * @param animationGroup the new animation group to be added
  629. */
  630. addAnimationGroup(animationGroup: BABYLON.AnimationGroup): void;
  631. /**
  632. * Get the ModelAnimation array
  633. */
  634. getAnimations(): Array<IModelAnimation>;
  635. /**
  636. * Get the animations' names. Using the names you can play a specific animation.
  637. */
  638. getAnimationNames(): Array<string>;
  639. /**
  640. * Get an animation by the provided name. Used mainly when playing n animation.
  641. * @param name the name of the animation to find
  642. */
  643. protected _getAnimationByName(name: string): BABYLON.Nullable<IModelAnimation>;
  644. /**
  645. * Choose an initialized animation using its name and start playing it
  646. * @param name the name of the animation to play
  647. * @returns The model aniamtion to be played.
  648. */
  649. playAnimation(name: string): IModelAnimation;
  650. setCurrentAnimationByName(name: string): IModelAnimation;
  651. /**
  652. * Apply a material configuration to a material
  653. * @param material BABYLON.Material to apply configuration to
  654. * @hidden
  655. */
  656. _applyModelMaterialConfiguration(material: BABYLON.Material): void;
  657. /**
  658. * Begin @animations with the specified @easingFunction
  659. * @param animations The BABYLON Animations to begin
  660. * @param duration of transition, in seconds
  661. * @param easingFunction An easing function to apply
  662. * @param easingMode A easing mode to apply to the easingFunction
  663. * @param onAnimationEnd Call back trigger at the end of the animation.
  664. */
  665. transitionTo(animations: BABYLON.Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
  666. /**
  667. * Stops and removes all animations that have been applied to the model
  668. */
  669. stopAllAnimations(): void;
  670. /**
  671. * Will remove this model from the viewer (but NOT dispose it).
  672. */
  673. remove(): void;
  674. /**
  675. * Dispose this model, including all of its associated assets.
  676. */
  677. dispose(): void;
  678. }
  679. }
  680. declare module BabylonViewer {
  681. /**
  682. * BABYLON.Animation play mode enum - is the animation looping or playing once
  683. */
  684. export const enum AnimationPlayMode {
  685. ONCE = 0,
  686. LOOP = 1
  687. }
  688. /**
  689. * An enum representing the current state of an animation object
  690. */
  691. export const enum AnimationState {
  692. INIT = 0,
  693. PLAYING = 1,
  694. PAUSED = 2,
  695. STOPPED = 3,
  696. ENDED = 4
  697. }
  698. /**
  699. * The different type of easing functions available
  700. */
  701. export const enum EasingFunction {
  702. Linear = 0,
  703. CircleEase = 1,
  704. BackEase = 2,
  705. BounceEase = 3,
  706. CubicEase = 4,
  707. ElasticEase = 5,
  708. ExponentialEase = 6,
  709. PowerEase = 7,
  710. QuadraticEase = 8,
  711. QuarticEase = 9,
  712. QuinticEase = 10,
  713. SineEase = 11
  714. }
  715. /**
  716. * Defines a simple animation to be applied to a model (scale).
  717. */
  718. export interface ModelAnimationConfiguration {
  719. /**
  720. * Time of animation, in seconds
  721. */
  722. time: number;
  723. /**
  724. * Scale to apply
  725. */
  726. scaling?: BABYLON.Vector3;
  727. /**
  728. * Easing function to apply
  729. * See SPECTRE.EasingFunction
  730. */
  731. easingFunction?: number;
  732. /**
  733. * An Easing mode to apply to the easing function
  734. * See BABYLON.EasingFunction
  735. */
  736. easingMode?: number;
  737. }
  738. /**
  739. * This interface can be implemented to define new types of ModelAnimation objects.
  740. */
  741. export interface IModelAnimation {
  742. /**
  743. * Current animation state (playing, stopped etc')
  744. */
  745. readonly state: AnimationState;
  746. /**
  747. * the name of the animation
  748. */
  749. readonly name: string;
  750. /**
  751. * Get the max numbers of frame available in the animation group
  752. *
  753. * In correlation to an arry, this would be ".length"
  754. */
  755. readonly frames: number;
  756. /**
  757. * Get the current frame playing right now.
  758. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
  759. *
  760. * In correlation to an array, this would be the current index
  761. */
  762. readonly currentFrame: number;
  763. /**
  764. * BABYLON.Animation's FPS value
  765. */
  766. readonly fps: number;
  767. /**
  768. * Get or set the animation's speed ration (Frame-to-fps)
  769. */
  770. speedRatio: number;
  771. /**
  772. * Gets or sets the aimation's play mode.
  773. */
  774. playMode: AnimationPlayMode;
  775. /**
  776. * Start the animation
  777. */
  778. start(): any;
  779. /**
  780. * Stop the animation.
  781. * This will fail silently if the animation group is already stopped.
  782. */
  783. stop(): any;
  784. /**
  785. * Pause the animation
  786. * This will fail silently if the animation is not currently playing
  787. */
  788. pause(): any;
  789. /**
  790. * Reset this animation
  791. */
  792. reset(): any;
  793. /**
  794. * Restart the animation
  795. */
  796. restart(): any;
  797. /**
  798. * Go to a specific
  799. * @param frameNumber the frame number to go to
  800. */
  801. goToFrame(frameNumber: number): any;
  802. /**
  803. * Dispose this animation
  804. */
  805. dispose(): any;
  806. }
  807. /**
  808. * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
  809. * native GroupAnimation class.
  810. */
  811. export class GroupModelAnimation implements IModelAnimation {
  812. /**
  813. * Create a new GroupModelAnimation object using an BABYLON.AnimationGroup object
  814. * @param _animationGroup The aniamtion group to base the class on
  815. */
  816. constructor(_animationGroup: BABYLON.AnimationGroup);
  817. /**
  818. * Get the animation's name
  819. */
  820. readonly name: string;
  821. /**
  822. * Get the current animation's state
  823. */
  824. readonly state: AnimationState;
  825. /**
  826. * Sets the speed ratio to use for all animations
  827. */
  828. speedRatio: number;
  829. /**
  830. * Get the max numbers of frame available in the animation group
  831. *
  832. * In correlation to an arry, this would be ".length"
  833. */
  834. readonly frames: number;
  835. /**
  836. * Get the current frame playing right now.
  837. * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
  838. *
  839. * In correlation to an array, this would be the current index
  840. */
  841. readonly currentFrame: number;
  842. /**
  843. * Get the FPS value of this animation
  844. */
  845. readonly fps: number;
  846. /**
  847. * Set the play mode.
  848. * If the animation is played, it will continue playing at least once more, depending on the new play mode set.
  849. * If the animation is not set, the will be initialized and will wait for the user to start playing it.
  850. */
  851. playMode: AnimationPlayMode;
  852. /**
  853. * Reset the animation group
  854. */
  855. reset(): void;
  856. /**
  857. * Restart the animation group
  858. */
  859. restart(): void;
  860. /**
  861. *
  862. * @param frameNumber Go to a specific frame in the animation
  863. */
  864. goToFrame(frameNumber: number): void;
  865. /**
  866. * Start playing the animation.
  867. */
  868. start(): void;
  869. /**
  870. * Pause the animation
  871. */
  872. pause(): void;
  873. /**
  874. * Stop the animation.
  875. * This will fail silently if the animation group is already stopped.
  876. */
  877. stop(): void;
  878. /**
  879. * Dispose this animation object.
  880. */
  881. dispose(): void;
  882. }
  883. }
  884. declare module BabylonViewer {
  885. /**
  886. * This interface defines the structure of a loader plugin.
  887. * Any of those functions will be called if (!) the loader supports those callbacks.
  888. * Any loader supports onInit, onLoaded, onError and onProgress.
  889. */
  890. export interface ILoaderPlugin {
  891. onInit?: (loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel) => void;
  892. onLoaded?: (model: ViewerModel) => void;
  893. onError?: (message: string, exception?: any) => void;
  894. onProgress?: (progressEvent: BABYLON.SceneLoaderProgressEvent) => void;
  895. onExtensionLoaded?: (extension: BABYLON.IGLTFLoaderExtension) => void;
  896. onParsed?: (parsedData: BABYLON.IGLTFLoaderData) => void;
  897. onMeshLoaded?: (mesh: BABYLON.AbstractMesh) => void;
  898. onTextureLoaded?: (texture: BABYLON.BaseTexture) => void;
  899. onMaterialLoaded?: (material: BABYLON.Material) => void;
  900. onComplete?: () => void;
  901. }
  902. }
  903. declare module BabylonViewer {
  904. export interface IViewerTemplatePlugin {
  905. readonly templateName: string;
  906. readonly eventsToAttach?: Array<string>;
  907. interactionPredicate(event: EventCallback): boolean;
  908. onEvent?(event: EventCallback): void;
  909. addHTMLTemplate?(template: Template): void;
  910. }
  911. export abstract class AbstractViewerNavbarButton implements IViewerTemplatePlugin {
  912. readonly templateName: string;
  913. readonly eventsToAttach: Array<string>;
  914. protected _prepend: boolean;
  915. protected _buttonName: string;
  916. protected _buttonClass: string;
  917. protected _htmlTemplate: string;
  918. constructor(buttonName: string, buttonClass?: string, htmlTemplate?: string);
  919. interactionPredicate(event: EventCallback): boolean;
  920. abstract onEvent(event: EventCallback): void;
  921. addHTMLTemplate(template: Template): void;
  922. protected _generateHTMLElement(template: Template): Element | DocumentFragment;
  923. }
  924. }
  925. declare module BabylonViewer {
  926. /**
  927. *
  928. * @param name the name of the custom optimizer configuration
  929. * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
  930. */
  931. export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
  932. export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
  933. }
  934. declare module BabylonViewer {
  935. /**
  936. * Will attach an init function the the DOMContentLoaded event.
  937. * The init function will be removed automatically after the event was triggered.
  938. */
  939. export function initListeners(): void;
  940. /**
  941. * Select all HTML tags on the page that match the selector and initialize a viewer
  942. *
  943. * @param selector the selector to initialize the viewer on (default is 'babylon')
  944. */
  945. export function InitTags(selector?: string): void;
  946. }
  947. declare module BabylonViewer {
  948. }
  949. declare module BabylonViewer {
  950. export function getConfigurationKey(key: string, configObject: any): any;
  951. export interface ViewerConfiguration {
  952. version?: string;
  953. extends?: string;
  954. pageUrl?: string;
  955. configuration?: string | {
  956. url?: string;
  957. payload?: any;
  958. mapper?: string;
  959. };
  960. observers?: IObserversConfiguration;
  961. canvasElement?: string;
  962. model?: IModelConfiguration | string;
  963. scene?: ISceneConfiguration;
  964. optimizer?: ISceneOptimizerConfiguration | boolean;
  965. camera?: ICameraConfiguration;
  966. skybox?: boolean | ISkyboxConfiguration;
  967. ground?: boolean | IGroundConfiguration;
  968. lights?: {
  969. [name: string]: number | boolean | ILightConfiguration;
  970. };
  971. engine?: {
  972. renderInBackground?: boolean;
  973. antialiasing?: boolean;
  974. disableResize?: boolean;
  975. engineOptions?: BABYLON.EngineOptions;
  976. adaptiveQuality?: boolean;
  977. hdEnabled?: boolean;
  978. };
  979. templates?: {
  980. main: ITemplateConfiguration;
  981. [key: string]: ITemplateConfiguration;
  982. };
  983. customShaders?: {
  984. shaders?: {
  985. [key: string]: string;
  986. };
  987. includes?: {
  988. [key: string]: string;
  989. };
  990. };
  991. loaderPlugins?: {
  992. extendedMaterial?: boolean;
  993. msftLod?: boolean;
  994. telemetry?: boolean;
  995. minecraft?: boolean;
  996. [propName: string]: boolean | undefined;
  997. };
  998. environmentMap?: IEnvironmentMapConfiguration;
  999. vr?: IVRConfiguration;
  1000. lab?: {
  1001. flashlight?: boolean | {
  1002. exponent?: number;
  1003. angle?: number;
  1004. intensity?: number;
  1005. diffuse?: {
  1006. r: number;
  1007. g: number;
  1008. b: number;
  1009. };
  1010. specular?: {
  1011. r: number;
  1012. g: number;
  1013. b: number;
  1014. };
  1015. };
  1016. hideLoadingDelay?: number;
  1017. /** Deprecated */
  1018. assetsRootURL?: string;
  1019. environmentMainColor?: {
  1020. r: number;
  1021. g: number;
  1022. b: number;
  1023. };
  1024. /** Deprecated */
  1025. environmentMap?: {
  1026. /**
  1027. * Environment map texture path in relative to the asset folder.
  1028. */
  1029. texture: string;
  1030. /**
  1031. * Default rotation to apply to the environment map.
  1032. */
  1033. rotationY: number;
  1034. /**
  1035. * Tint level of the main color on the environment map.
  1036. */
  1037. tintLevel: number;
  1038. };
  1039. defaultRenderingPipelines?: boolean | IDefaultRenderingPipelineConfiguration;
  1040. globalLightRotation?: number;
  1041. };
  1042. }
  1043. }
  1044. declare module BabylonViewer {
  1045. /**
  1046. * The object sent when an event is triggered
  1047. */
  1048. export interface EventCallback {
  1049. event: Event;
  1050. template: Template;
  1051. selector: string;
  1052. payload?: any;
  1053. }
  1054. /**
  1055. * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
  1056. * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
  1057. */
  1058. export class TemplateManager {
  1059. containerElement: Element;
  1060. /**
  1061. * Will be triggered when any template is initialized
  1062. */
  1063. onTemplateInit: BABYLON.Observable<Template>;
  1064. /**
  1065. * Will be triggered when any template is fully loaded
  1066. */
  1067. onTemplateLoaded: BABYLON.Observable<Template>;
  1068. /**
  1069. * Will be triggered when a template state changes
  1070. */
  1071. onTemplateStateChange: BABYLON.Observable<Template>;
  1072. /**
  1073. * Will be triggered when all templates finished loading
  1074. */
  1075. onAllLoaded: BABYLON.Observable<TemplateManager>;
  1076. /**
  1077. * Will be triggered when any event on any template is triggered.
  1078. */
  1079. onEventTriggered: BABYLON.Observable<EventCallback>;
  1080. /**
  1081. * This template manager's event manager. In charge of callback registrations to native event types
  1082. */
  1083. eventManager: EventManager;
  1084. constructor(containerElement: Element);
  1085. /**
  1086. * Initialize the template(s) for the viewer. Called bay the Viewer class
  1087. * @param templates the templates to be used to initialize the main template
  1088. */
  1089. initTemplate(templates: {
  1090. [key: string]: ITemplateConfiguration;
  1091. }): Promise<void>;
  1092. /**
  1093. * Get the canvas in the template tree.
  1094. * There must be one and only one canvas inthe template.
  1095. */
  1096. getCanvas(): HTMLCanvasElement | null;
  1097. /**
  1098. * Get a specific template from the template tree
  1099. * @param name the name of the template to load
  1100. */
  1101. getTemplate(name: string): Template | undefined;
  1102. /**
  1103. * Dispose the template manager
  1104. */
  1105. dispose(): void;
  1106. }
  1107. /**
  1108. * This class represents a single template in the viewer's template tree.
  1109. * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
  1110. * A template is injected using the template manager in the correct position.
  1111. * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
  1112. *
  1113. * For further information please refer to the documentation page, https://doc.babylonjs.com
  1114. */
  1115. export class Template {
  1116. name: string;
  1117. /**
  1118. * Will be triggered when the template is loaded
  1119. */
  1120. onLoaded: BABYLON.Observable<Template>;
  1121. /**
  1122. * will be triggered when the template is appended to the tree
  1123. */
  1124. onAppended: BABYLON.Observable<Template>;
  1125. /**
  1126. * Will be triggered when the template's state changed (shown, hidden)
  1127. */
  1128. onStateChange: BABYLON.Observable<Template>;
  1129. /**
  1130. * Will be triggered when an event is triggered on ths template.
  1131. * The event is a native browser event (like mouse or pointer events)
  1132. */
  1133. onEventTriggered: BABYLON.Observable<EventCallback>;
  1134. onParamsUpdated: BABYLON.Observable<Template>;
  1135. onHTMLRendered: BABYLON.Observable<Template>;
  1136. /**
  1137. * is the template loaded?
  1138. */
  1139. isLoaded: boolean;
  1140. /**
  1141. * This is meant to be used to track the show and hide functions.
  1142. * This is NOT (!!) a flag to check if the element is actually visible to the user.
  1143. */
  1144. isShown: boolean;
  1145. /**
  1146. * Is this template a part of the HTML tree (the template manager injected it)
  1147. */
  1148. isInHtmlTree: boolean;
  1149. /**
  1150. * The HTML element containing this template
  1151. */
  1152. parent: HTMLElement;
  1153. /**
  1154. * A promise that is fulfilled when the template finished loading.
  1155. */
  1156. initPromise: Promise<Template>;
  1157. constructor(name: string, _configuration: ITemplateConfiguration);
  1158. /**
  1159. * Some templates have parameters (like background color for example).
  1160. * The parameters are provided to Handlebars which in turn generates the template.
  1161. * This function will update the template with the new parameters
  1162. *
  1163. * Note that when updating parameters the events will be registered again (after being cleared).
  1164. *
  1165. * @param params the new template parameters
  1166. */
  1167. updateParams(params: {
  1168. [key: string]: string | number | boolean | object;
  1169. }, append?: boolean): void;
  1170. redraw(): void;
  1171. /**
  1172. * Get the template'S configuration
  1173. */
  1174. readonly configuration: ITemplateConfiguration;
  1175. /**
  1176. * A template can be a parent element for other templates or HTML elements.
  1177. * This function will deliver all child HTML elements of this template.
  1178. */
  1179. getChildElements(): Array<string>;
  1180. /**
  1181. * Appending the template to a parent HTML element.
  1182. * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
  1183. * @param parent the parent to which the template is added
  1184. * @param forceRemove if the parent already exists, shoud the template be removed from it?
  1185. */
  1186. appendTo(parent: HTMLElement, forceRemove?: boolean): void;
  1187. /**
  1188. * Show the template using the provided visibilityFunction, or natively using display: flex.
  1189. * The provided function returns a promise that should be fullfilled when the element is shown.
  1190. * Since it is a promise async operations are more than possible.
  1191. * See the default viewer for an opacity example.
  1192. * @param visibilityFunction The function to execute to show the template.
  1193. */
  1194. show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1195. /**
  1196. * Hide the template using the provided visibilityFunction, or natively using display: none.
  1197. * The provided function returns a promise that should be fullfilled when the element is hidden.
  1198. * Since it is a promise async operations are more than possible.
  1199. * See the default viewer for an opacity example.
  1200. * @param visibilityFunction The function to execute to show the template.
  1201. */
  1202. hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1203. /**
  1204. * Dispose this template
  1205. */
  1206. dispose(): void;
  1207. }
  1208. }
  1209. declare module BabylonViewer {
  1210. export class ConfigurationContainer {
  1211. configuration: ViewerConfiguration;
  1212. viewerId: string;
  1213. mainColor: BABYLON.Color3;
  1214. reflectionColor: BABYLON.Color3;
  1215. scene?: BABYLON.Scene;
  1216. }
  1217. }
  1218. declare module BabylonViewer {
  1219. /**
  1220. * The configuration loader will load the configuration object from any source and will use the defined mapper to
  1221. * parse the object and return a conform ViewerConfiguration.
  1222. * It is a private member of the scene.
  1223. */
  1224. export class ConfigurationLoader {
  1225. constructor(_enableCache?: boolean);
  1226. /**
  1227. * load a configuration object that is defined in the initial configuration provided.
  1228. * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
  1229. *
  1230. * @param initConfig the initial configuration that has the definitions of further configuration to load.
  1231. * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
  1232. * @returns A promise that delivers the extended viewer configuration, when done.
  1233. */
  1234. loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
  1235. /**
  1236. * Dispose the configuration loader. This will cancel file requests, if active.
  1237. */
  1238. dispose(): void;
  1239. }
  1240. }
  1241. declare module BabylonViewer {
  1242. export class ObservablesManager {
  1243. /**
  1244. * Will notify when the scene was initialized
  1245. */
  1246. onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  1247. /**
  1248. * will notify when the engine was initialized
  1249. */
  1250. onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
  1251. /**
  1252. * Will notify when a new model was added to the scene.
  1253. * Note that added does not neccessarily mean loaded!
  1254. */
  1255. onModelAddedObservable: BABYLON.Observable<ViewerModel>;
  1256. /**
  1257. * will notify after every model load
  1258. */
  1259. onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
  1260. /**
  1261. * will notify when any model notify of progress
  1262. */
  1263. onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  1264. /**
  1265. * will notify when any model load failed.
  1266. */
  1267. onModelLoadErrorObservable: BABYLON.Observable<{
  1268. message: string;
  1269. exception: any;
  1270. }>;
  1271. /**
  1272. * Will notify when a model was removed from the scene;
  1273. */
  1274. onModelRemovedObservable: BABYLON.Observable<ViewerModel>;
  1275. /**
  1276. * will notify when a new loader was initialized.
  1277. * Used mainly to know when a model starts loading.
  1278. */
  1279. onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
  1280. /**
  1281. * Observers registered here will be executed when the entire load process has finished.
  1282. */
  1283. onViewerInitDoneObservable: BABYLON.Observable<any>;
  1284. /**
  1285. * Will notify when the viewer init started (after configuration was loaded)
  1286. */
  1287. onViewerInitStartedObservable: BABYLON.Observable<any>;
  1288. /**
  1289. * Functions added to this observable will be executed on each frame rendered.
  1290. */
  1291. onFrameRenderedObservable: BABYLON.Observable<any>;
  1292. /**
  1293. * Will notify when VR mode is entered.
  1294. */
  1295. onEnteringVRObservable: BABYLON.Observable<any>;
  1296. /**
  1297. * Will notify when VR mode is exited.
  1298. */
  1299. onExitingVRObservable: BABYLON.Observable<any>;
  1300. constructor();
  1301. dispose(): void;
  1302. }
  1303. }
  1304. declare module BabylonViewer {
  1305. /**
  1306. * This interface describes the structure of the variable sent with the configuration observables of the scene manager.
  1307. * O - the type of object we are dealing with (Light, BABYLON.ArcRotateCamera, BABYLON.Scene, etc')
  1308. * T - the configuration type
  1309. */
  1310. export interface IPostConfigurationCallback<OBJ, CONF> {
  1311. newConfiguration: CONF;
  1312. sceneManager: SceneManager;
  1313. object: OBJ;
  1314. model?: ViewerModel;
  1315. }
  1316. export class SceneManager {
  1317. /**
  1318. * Will notify when the scene was initialized
  1319. */
  1320. onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  1321. /**
  1322. * Will notify after the scene was configured. Can be used to further configure the scene
  1323. */
  1324. onSceneConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.Scene, ISceneConfiguration>>;
  1325. /**
  1326. * Will notify after the scene optimized was configured. Can be used to further configure the scene optimizer
  1327. */
  1328. onSceneOptimizerConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.SceneOptimizer, ISceneOptimizerConfiguration | boolean>>;
  1329. /**
  1330. * Will notify after the camera was configured. Can be used to further configure the camera
  1331. */
  1332. onCameraConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.ArcRotateCamera, ICameraConfiguration>>;
  1333. /**
  1334. * Will notify after the lights were configured. Can be used to further configure lights
  1335. */
  1336. onLightsConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<Array<BABYLON.Light>, {
  1337. [name: string]: ILightConfiguration | boolean | number;
  1338. }>>;
  1339. /**
  1340. * Will notify after the model(s) were configured. Can be used to further configure models
  1341. */
  1342. onModelsConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<Array<ViewerModel>, IModelConfiguration>>;
  1343. /**
  1344. * Will notify after the envirnoment was configured. Can be used to further configure the environment
  1345. */
  1346. onEnvironmentConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.EnvironmentHelper, {
  1347. skybox?: ISkyboxConfiguration | boolean;
  1348. ground?: IGroundConfiguration | boolean;
  1349. }>>;
  1350. /**
  1351. * Will notify after the model(s) were configured. Can be used to further configure models
  1352. */
  1353. onVRConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.VRExperienceHelper, IVRConfiguration>>;
  1354. /**
  1355. * The Babylon BABYLON.Scene of this viewer
  1356. */
  1357. scene: BABYLON.Scene;
  1358. /**
  1359. * The camera used in this viewer
  1360. */
  1361. camera: BABYLON.ArcRotateCamera;
  1362. /**
  1363. * Babylon's scene optimizer
  1364. */
  1365. sceneOptimizer: BABYLON.SceneOptimizer;
  1366. /**
  1367. * Models displayed in this viewer.
  1368. */
  1369. models: Array<ViewerModel>;
  1370. /**
  1371. * Babylon's environment helper of this viewer
  1372. */
  1373. environmentHelper?: BABYLON.EnvironmentHelper;
  1374. protected _defaultHighpTextureType: number;
  1375. protected _shadowGeneratorBias: number;
  1376. protected _defaultPipelineTextureType: number;
  1377. /**
  1378. * The maximum number of shadows supported by the curent viewer
  1379. */
  1380. protected _maxShadows: number;
  1381. /**
  1382. * The labs variable consists of objects that will have their API change.
  1383. * Please be careful when using labs in production.
  1384. */
  1385. labs: ViewerLabs;
  1386. readonly defaultRenderingPipeline: BABYLON.Nullable<BABYLON.DefaultRenderingPipeline>;
  1387. protected _vrHelper?: BABYLON.VRExperienceHelper;
  1388. readonly vrHelper: BABYLON.VRExperienceHelper | undefined;
  1389. constructor(_engine: BABYLON.Engine, _configurationContainer: ConfigurationContainer, _observablesManager?: ObservablesManager | undefined);
  1390. /**
  1391. * Returns a boolean representing HDR support
  1392. */
  1393. readonly isHdrSupported: boolean;
  1394. /**
  1395. * Return the main color defined in the configuration.
  1396. */
  1397. readonly mainColor: BABYLON.Color3;
  1398. readonly reflectionColor: BABYLON.Color3;
  1399. animationBlendingEnabled: boolean;
  1400. readonly observablesManager: ObservablesManager | undefined;
  1401. /**
  1402. * Should shadows be rendered every frame, or only once and stop.
  1403. * This can be used to optimize a scene.
  1404. *
  1405. * Not that the shadows will NOT disapear but will remain in place.
  1406. * @param process if true shadows will be updated once every frame. if false they will stop being updated.
  1407. */
  1408. processShadows: boolean;
  1409. groundEnabled: boolean;
  1410. /**
  1411. * sets wether the reflection is disabled.
  1412. */
  1413. groundMirrorEnabled: boolean;
  1414. defaultRenderingPipelineEnabled: boolean;
  1415. /**
  1416. * Sets the engine flags to unlock all babylon features.
  1417. * Can also be configured using the scene.flags configuration object
  1418. */
  1419. unlockBabylonFeatures(): void;
  1420. /**
  1421. * initialize the scene. Calling this function again will dispose the old scene, if exists.
  1422. */
  1423. initScene(sceneConfiguration?: ISceneConfiguration, optimizerConfiguration?: boolean | ISceneOptimizerConfiguration): Promise<BABYLON.Scene>;
  1424. clearScene(clearModels?: boolean, clearLights?: boolean): void;
  1425. /**
  1426. * This will update the scene's configuration, including camera, lights, environment.
  1427. * @param newConfiguration the delta that should be configured. This includes only the changes
  1428. * @param globalConfiguration The global configuration object, after the new configuration was merged into it
  1429. */
  1430. updateConfiguration(newConfiguration: Partial<ViewerConfiguration>): void;
  1431. bloomEnabled: boolean;
  1432. fxaaEnabled: boolean;
  1433. /**
  1434. * internally configure the scene using the provided configuration.
  1435. * The scene will not be recreated, but just updated.
  1436. * @param sceneConfig the (new) scene configuration
  1437. */
  1438. protected _configureScene(sceneConfig: ISceneConfiguration): void;
  1439. /**
  1440. * Configure the scene optimizer.
  1441. * The existing scene optimizer will be disposed and a new one will be created.
  1442. * @param optimizerConfig the (new) optimizer configuration
  1443. */
  1444. protected _configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
  1445. /**
  1446. * configure all models using the configuration.
  1447. * @param modelConfiguration the configuration to use to reconfigure the models
  1448. */
  1449. protected _configureVR(vrConfig: IVRConfiguration): void;
  1450. protected _configureEnvironmentMap(environmentMapConfiguration: IEnvironmentMapConfiguration): any;
  1451. /**
  1452. * (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
  1453. * @param cameraConfig the new camera configuration
  1454. * @param model optionally use the model to configure the camera.
  1455. */
  1456. protected _configureCamera(cameraConfig?: ICameraConfiguration): void;
  1457. protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void;
  1458. /**
  1459. * configure the lights.
  1460. *
  1461. * @param lightsConfiguration the (new) light(s) configuration
  1462. * @param model optionally use the model to configure the camera.
  1463. */
  1464. protected _configureLights(lightsConfiguration?: {
  1465. [name: string]: ILightConfiguration | boolean | number;
  1466. }): void;
  1467. /**
  1468. * Gets the shadow map blur kernel according to the light configuration.
  1469. * @param light The light used to generate the shadows
  1470. * @param bufferSize The size of the shadow map
  1471. * @return the kernel blur size
  1472. */
  1473. getBlurKernel(light: BABYLON.IShadowLight, bufferSize: number): number;
  1474. /**
  1475. * Alters render settings to reduce features based on hardware feature limitations
  1476. * @param enableHDR Allows the viewer to run in HDR mode.
  1477. */
  1478. protected _handleHardwareLimitations(enableHDR?: boolean): void;
  1479. /**
  1480. * Dispoe the entire viewer including the scene and the engine
  1481. */
  1482. dispose(): void;
  1483. }
  1484. }
  1485. declare module BabylonViewer {
  1486. export interface IModelConfiguration {
  1487. id?: string;
  1488. url?: string;
  1489. root?: string;
  1490. file?: string | File;
  1491. loader?: string;
  1492. position?: {
  1493. x: number;
  1494. y: number;
  1495. z: number;
  1496. };
  1497. rotation?: {
  1498. x: number;
  1499. y: number;
  1500. z: number;
  1501. w?: number;
  1502. };
  1503. scaling?: {
  1504. x: number;
  1505. y: number;
  1506. z: number;
  1507. };
  1508. parentObjectIndex?: number;
  1509. castShadow?: boolean;
  1510. receiveShadows?: boolean;
  1511. normalize?: boolean | {
  1512. center?: boolean;
  1513. unitSize?: boolean;
  1514. parentIndex?: number;
  1515. };
  1516. title?: string;
  1517. subtitle?: string;
  1518. thumbnail?: string;
  1519. animation?: {
  1520. autoStart?: boolean | string;
  1521. playOnce?: boolean;
  1522. autoStartIndex?: number;
  1523. };
  1524. entryAnimation?: IModelAnimationConfiguration;
  1525. exitAnimation?: IModelAnimationConfiguration;
  1526. material?: {
  1527. directEnabled?: boolean;
  1528. directIntensity?: number;
  1529. emissiveIntensity?: number;
  1530. environmentIntensity?: number;
  1531. [propName: string]: any;
  1532. };
  1533. /**
  1534. * Rotation offset axis definition
  1535. */
  1536. rotationOffsetAxis?: {
  1537. x: number;
  1538. y: number;
  1539. z: number;
  1540. };
  1541. /**
  1542. * the offset angle
  1543. */
  1544. rotationOffsetAngle?: number;
  1545. loaderConfiguration?: {
  1546. maxLODsToLoad?: number;
  1547. progressiveLoading?: boolean;
  1548. };
  1549. }
  1550. }
  1551. declare module BabylonViewer {
  1552. /**
  1553. * Get a loader plugin according to its name.
  1554. * The plugin will be cached and will be reused if called for again.
  1555. *
  1556. * @param name the name of the plugin
  1557. */
  1558. export function getLoaderPluginByName(name: string): ILoaderPlugin;
  1559. /**
  1560. *
  1561. */
  1562. export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
  1563. }
  1564. declare module BabylonViewer {
  1565. }
  1566. declare module BabylonViewer {
  1567. export interface IEnvironmentMapConfiguration {
  1568. /**
  1569. * Environment map texture path in relative to the asset folder.
  1570. */
  1571. texture: string;
  1572. /**
  1573. * Default rotation to apply to the environment map.
  1574. */
  1575. rotationY: number;
  1576. /**
  1577. * Tint level of the main color on the environment map.
  1578. */
  1579. tintLevel: number;
  1580. /**
  1581. * The environment's main color.
  1582. */
  1583. mainColor?: {
  1584. r?: number;
  1585. g?: number;
  1586. b?: number;
  1587. };
  1588. }
  1589. }
  1590. declare module BabylonViewer {
  1591. /**
  1592. * The EventManager is in charge of registering user interctions with the viewer.
  1593. * It is used in the TemplateManager
  1594. */
  1595. export class EventManager {
  1596. constructor(_templateManager: TemplateManager);
  1597. /**
  1598. * Register a new callback to a specific template.
  1599. * The best example for the usage can be found in the DefaultViewer
  1600. *
  1601. * @param templateName the templateName to register the event to
  1602. * @param callback The callback to be executed
  1603. * @param eventType the type of event to register
  1604. * @param selector an optional selector. if not defined the parent object in the template will be selected
  1605. */
  1606. registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1607. /**
  1608. * This will remove a registered event from the defined template.
  1609. * Each one of the variables apart from the template name are optional, but one must be provided.
  1610. *
  1611. * @param templateName the templateName
  1612. * @param callback the callback to remove (optional)
  1613. * @param eventType the event type to remove (optional)
  1614. * @param selector the selector from which to remove the event (optional)
  1615. */
  1616. unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1617. /**
  1618. * Dispose the event manager
  1619. */
  1620. dispose(): void;
  1621. }
  1622. }
  1623. declare module BabylonViewer {
  1624. /**
  1625. * The ViewerLabs class will hold functions that are not (!) backwards compatible.
  1626. * The APIs in all labs-related classes and configuration might change.
  1627. * Once stable, lab features will be moved to the publis API and configuration object.
  1628. */
  1629. export class ViewerLabs {
  1630. constructor(_scene: BABYLON.Scene);
  1631. assetsRootURL: string;
  1632. environment: PBREnvironment;
  1633. /**
  1634. * Loads an environment map from a given URL
  1635. * @param url URL of environment map
  1636. * @param onSuccess Callback fired after environment successfully applied to the scene
  1637. * @param onProgress Callback fired at progress events while loading the environment map
  1638. * @param onError Callback fired when the load fails
  1639. */
  1640. loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
  1641. /**
  1642. * Loads an environment map from a given URL
  1643. * @param buffer ArrayBuffer containing environment map
  1644. * @param onSuccess Callback fired after environment successfully applied to the scene
  1645. * @param onProgress Callback fired at progress events while loading the environment map
  1646. * @param onError Callback fired when the load fails
  1647. */
  1648. loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
  1649. /**
  1650. * Sets the environment to an already loaded environment
  1651. * @param env PBREnvironment instance
  1652. * @param onSuccess Callback fired after environment successfully applied to the scene
  1653. * @param onProgress Callback fired at progress events while loading the environment map
  1654. * @param onError Callback fired when the load fails
  1655. */
  1656. loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
  1657. /**
  1658. * Applies an `EnvironmentMapConfiguration` to the scene
  1659. * @param environmentMapConfiguration Environment map configuration to apply
  1660. */
  1661. applyEnvironmentMapConfiguration(rotationY?: number): void;
  1662. /**
  1663. * Get an environment asset url by using the configuration if the path is not absolute.
  1664. * @param url Asset url
  1665. * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
  1666. */
  1667. getAssetUrl(url: string): string;
  1668. rotateShadowLight(shadowLight: BABYLON.ShadowLight, amount: number, point?: BABYLON.Vector3, axis?: BABYLON.Vector3, target?: BABYLON.Vector3): void;
  1669. }
  1670. }
  1671. declare module BabylonViewer {
  1672. /**
  1673. * Defines an animation to be applied to a model (translation, scale or rotation).
  1674. */
  1675. export interface IModelAnimationConfiguration {
  1676. /**
  1677. * Time of animation, in seconds
  1678. */
  1679. time?: number;
  1680. /**
  1681. * Scale to apply
  1682. */
  1683. scaling?: {
  1684. x: number;
  1685. y: number;
  1686. z: number;
  1687. };
  1688. /**
  1689. * Easing function to apply
  1690. */
  1691. easingFunction?: number;
  1692. /**
  1693. * An Easing mode to apply to the easing function
  1694. * See BABYLON.EasingFunction
  1695. */
  1696. easingMode?: number;
  1697. }
  1698. }
  1699. declare module BabylonViewer {
  1700. export class TelemetryLoaderPlugin implements ILoaderPlugin {
  1701. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1702. onLoaded(model: ViewerModel): void;
  1703. onError(message: string, exception: any): void;
  1704. onComplete(): void;
  1705. }
  1706. }
  1707. declare module BabylonViewer {
  1708. /**
  1709. * A loder plugin to use MSFT_lod extension correctly (glTF)
  1710. */
  1711. export class MSFTLodLoaderPlugin implements ILoaderPlugin {
  1712. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1713. onExtensionLoaded(extension: BABYLON.IGLTFLoaderExtension): void;
  1714. }
  1715. }
  1716. declare module BabylonViewer {
  1717. /**
  1718. * Force-apply material configuration right after a material was loaded.
  1719. */
  1720. export class ApplyMaterialConfigPlugin implements ILoaderPlugin {
  1721. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1722. onMaterialLoaded(material: BABYLON.Material): void;
  1723. }
  1724. }
  1725. declare module BabylonViewer {
  1726. /**
  1727. * A (PBR) material will be extended using this function.
  1728. * This function will hold extra default configuration for the viewer, if not implemented in Babylon itself.
  1729. */
  1730. export class ExtendedMaterialLoaderPlugin implements ILoaderPlugin {
  1731. onMaterialLoaded(baseMaterial: BABYLON.Material): void;
  1732. }
  1733. }
  1734. declare module BabylonViewer {
  1735. export interface ICameraConfiguration {
  1736. position?: {
  1737. x: number;
  1738. y: number;
  1739. z: number;
  1740. };
  1741. rotation?: {
  1742. x: number;
  1743. y: number;
  1744. z: number;
  1745. w: number;
  1746. };
  1747. fov?: number;
  1748. fovMode?: number;
  1749. minZ?: number;
  1750. maxZ?: number;
  1751. inertia?: number;
  1752. exposure?: number;
  1753. pinchPrecision?: number;
  1754. behaviors?: {
  1755. [name: string]: boolean | number | ICameraBehaviorConfiguration;
  1756. };
  1757. disableCameraControl?: boolean;
  1758. disableCtrlForPanning?: boolean;
  1759. disableAutoFocus?: boolean;
  1760. [propName: string]: any;
  1761. }
  1762. export interface ICameraBehaviorConfiguration {
  1763. type: number;
  1764. [propName: string]: any;
  1765. }
  1766. }
  1767. declare module BabylonViewer {
  1768. /**
  1769. * The Color Grading Configuration groups the different settings used to define the color grading used in the viewer.
  1770. */
  1771. export interface IColorGradingConfiguration {
  1772. /**
  1773. * Transform data string, encoded as determined by transformDataFormat.
  1774. */
  1775. transformData: string;
  1776. /**
  1777. * The encoding format of TransformData (currently only raw-base16 is supported).
  1778. */
  1779. transformDataFormat: string;
  1780. /**
  1781. * The weight of the transform
  1782. */
  1783. transformWeight: number;
  1784. /**
  1785. * Color curve colorFilterHueGlobal value
  1786. */
  1787. colorFilterHueGlobal: number;
  1788. /**
  1789. * Color curve colorFilterHueShadows value
  1790. */
  1791. colorFilterHueShadows: number;
  1792. /**
  1793. * Color curve colorFilterHueMidtones value
  1794. */
  1795. colorFilterHueMidtones: number;
  1796. /**
  1797. * Color curve colorFilterHueHighlights value
  1798. */
  1799. colorFilterHueHighlights: number;
  1800. /**
  1801. * Color curve colorFilterDensityGlobal value
  1802. */
  1803. colorFilterDensityGlobal: number;
  1804. /**
  1805. * Color curve colorFilterDensityShadows value
  1806. */
  1807. colorFilterDensityShadows: number;
  1808. /**
  1809. * Color curve colorFilterDensityMidtones value
  1810. */
  1811. colorFilterDensityMidtones: number;
  1812. /**
  1813. * Color curve colorFilterDensityHighlights value
  1814. */
  1815. colorFilterDensityHighlights: number;
  1816. /**
  1817. * Color curve saturationGlobal value
  1818. */
  1819. saturationGlobal: number;
  1820. /**
  1821. * Color curve saturationShadows value
  1822. */
  1823. saturationShadows: number;
  1824. /**
  1825. * Color curve saturationMidtones value
  1826. */
  1827. saturationMidtones: number;
  1828. /**
  1829. * Color curve saturationHighlights value
  1830. */
  1831. saturationHighlights: number;
  1832. /**
  1833. * Color curve exposureGlobal value
  1834. */
  1835. exposureGlobal: number;
  1836. /**
  1837. * Color curve exposureShadows value
  1838. */
  1839. exposureShadows: number;
  1840. /**
  1841. * Color curve exposureMidtones value
  1842. */
  1843. exposureMidtones: number;
  1844. /**
  1845. * Color curve exposureHighlights value
  1846. */
  1847. exposureHighlights: number;
  1848. }
  1849. }
  1850. declare module BabylonViewer {
  1851. export interface IDefaultRenderingPipelineConfiguration {
  1852. sharpenEnabled?: boolean;
  1853. bloomEnabled?: boolean;
  1854. bloomThreshold?: number;
  1855. depthOfFieldEnabled?: boolean;
  1856. depthOfFieldBlurLevel?: BABYLON.DepthOfFieldEffectBlurLevel;
  1857. fxaaEnabled?: boolean;
  1858. imageProcessingEnabled?: boolean;
  1859. defaultPipelineTextureType?: number;
  1860. bloomScale?: number;
  1861. chromaticAberrationEnabled?: boolean;
  1862. grainEnabled?: boolean;
  1863. bloomKernel?: number;
  1864. hardwareScaleLevel?: number;
  1865. bloomWeight?: number;
  1866. hdr?: boolean;
  1867. samples?: number;
  1868. glowLayerEnabled?: boolean;
  1869. }
  1870. }
  1871. declare module BabylonViewer {
  1872. export interface IGroundConfiguration {
  1873. size?: number;
  1874. receiveShadows?: boolean;
  1875. shadowLevel?: number;
  1876. shadowOnly?: boolean;
  1877. mirror?: boolean | {
  1878. sizeRatio?: number;
  1879. blurKernel?: number;
  1880. amount?: number;
  1881. fresnelWeight?: number;
  1882. fallOffDistance?: number;
  1883. textureType?: number;
  1884. };
  1885. texture?: string;
  1886. color?: {
  1887. r: number;
  1888. g: number;
  1889. b: number;
  1890. };
  1891. opacity?: number;
  1892. material?: {
  1893. [propName: string]: any;
  1894. };
  1895. }
  1896. }
  1897. declare module BabylonViewer {
  1898. export interface IImageProcessingConfiguration {
  1899. colorGradingEnabled?: boolean;
  1900. colorCurvesEnabled?: boolean;
  1901. colorCurves?: {
  1902. globalHue?: number;
  1903. globalDensity?: number;
  1904. globalSaturation?: number;
  1905. globalExposure?: number;
  1906. highlightsHue?: number;
  1907. highlightsDensity?: number;
  1908. highlightsSaturation?: number;
  1909. highlightsExposure?: number;
  1910. midtonesHue?: number;
  1911. midtonesDensity?: number;
  1912. midtonesSaturation?: number;
  1913. midtonesExposure?: number;
  1914. shadowsHue?: number;
  1915. shadowsDensity?: number;
  1916. shadowsSaturation?: number;
  1917. shadowsExposure?: number;
  1918. };
  1919. colorGradingWithGreenDepth?: boolean;
  1920. colorGradingBGR?: boolean;
  1921. exposure?: number;
  1922. toneMappingEnabled?: boolean;
  1923. contrast?: number;
  1924. vignetteEnabled?: boolean;
  1925. vignetteStretch?: number;
  1926. vignetteCentreX?: number;
  1927. vignetteCentreY?: number;
  1928. vignetteWeight?: number;
  1929. vignetteColor?: {
  1930. r: number;
  1931. g: number;
  1932. b: number;
  1933. a?: number;
  1934. };
  1935. vignetteCameraFov?: number;
  1936. vignetteBlendMode?: number;
  1937. vignetteM?: boolean;
  1938. applyByPostProcess?: boolean;
  1939. isEnabled?: boolean;
  1940. }
  1941. }
  1942. declare module BabylonViewer {
  1943. export interface ILightConfiguration {
  1944. type: number;
  1945. name?: string;
  1946. disabled?: boolean;
  1947. position?: {
  1948. x: number;
  1949. y: number;
  1950. z: number;
  1951. };
  1952. target?: {
  1953. x: number;
  1954. y: number;
  1955. z: number;
  1956. };
  1957. direction?: {
  1958. x: number;
  1959. y: number;
  1960. z: number;
  1961. };
  1962. diffuse?: {
  1963. r: number;
  1964. g: number;
  1965. b: number;
  1966. };
  1967. specular?: {
  1968. r: number;
  1969. g: number;
  1970. b: number;
  1971. };
  1972. intensity?: number;
  1973. intensityMode?: number;
  1974. radius?: number;
  1975. shadownEnabled?: boolean;
  1976. shadowConfig?: {
  1977. useBlurExponentialShadowMap?: boolean;
  1978. useBlurCloseExponentialShadowMap?: boolean;
  1979. useKernelBlur?: boolean;
  1980. blurKernel?: number;
  1981. blurScale?: number;
  1982. minZ?: number;
  1983. maxZ?: number;
  1984. frustumSize?: number;
  1985. angleScale?: number;
  1986. frustumEdgeFalloff?: number;
  1987. [propName: string]: any;
  1988. };
  1989. spotAngle?: number;
  1990. shadowFieldOfView?: number;
  1991. shadowBufferSize?: number;
  1992. shadowFrustumSize?: number;
  1993. shadowMinZ?: number;
  1994. shadowMaxZ?: number;
  1995. [propName: string]: any;
  1996. behaviors?: {
  1997. [name: string]: number | {
  1998. type: number;
  1999. [propName: string]: any;
  2000. };
  2001. };
  2002. }
  2003. }
  2004. declare module BabylonViewer {
  2005. export interface IObserversConfiguration {
  2006. onEngineInit?: string;
  2007. onSceneInit?: string;
  2008. onModelLoaded?: string;
  2009. }
  2010. }
  2011. declare module BabylonViewer {
  2012. export interface ISceneConfiguration {
  2013. debug?: boolean;
  2014. clearColor?: {
  2015. r: number;
  2016. g: number;
  2017. b: number;
  2018. a: number;
  2019. };
  2020. /** Deprecated, use environmentMap.mainColor instead. */
  2021. mainColor?: {
  2022. r?: number;
  2023. g?: number;
  2024. b?: number;
  2025. };
  2026. imageProcessingConfiguration?: IImageProcessingConfiguration;
  2027. environmentTexture?: string;
  2028. colorGrading?: IColorGradingConfiguration;
  2029. environmentRotationY?: number;
  2030. /**
  2031. * Deprecated, please use default rendering pipeline
  2032. */
  2033. glow?: boolean | BABYLON.IGlowLayerOptions;
  2034. disableHdr?: boolean;
  2035. renderInBackground?: boolean;
  2036. disableCameraControl?: boolean;
  2037. animationPropertiesOverride?: {
  2038. [propName: string]: any;
  2039. };
  2040. defaultMaterial?: {
  2041. materialType: "standard" | "pbr";
  2042. [propName: string]: any;
  2043. };
  2044. flags?: {
  2045. shadowsEnabled?: boolean;
  2046. particlesEnabled?: boolean;
  2047. collisionsEnabled?: boolean;
  2048. lightsEnabled?: boolean;
  2049. texturesEnabled?: boolean;
  2050. lensFlaresEnabled?: boolean;
  2051. proceduralTexturesEnabled?: boolean;
  2052. renderTargetsEnabled?: boolean;
  2053. spritesEnabled?: boolean;
  2054. skeletonsEnabled?: boolean;
  2055. audioEnabled?: boolean;
  2056. };
  2057. assetsRootURL?: string;
  2058. }
  2059. }
  2060. declare module BabylonViewer {
  2061. export interface ISceneOptimizerConfiguration {
  2062. targetFrameRate?: number;
  2063. trackerDuration?: number;
  2064. autoGeneratePriorities?: boolean;
  2065. improvementMode?: boolean;
  2066. degradation?: string;
  2067. types?: {
  2068. texture?: ISceneOptimizerParameters;
  2069. hardwareScaling?: ISceneOptimizerParameters;
  2070. shadow?: ISceneOptimizerParameters;
  2071. postProcess?: ISceneOptimizerParameters;
  2072. lensFlare?: ISceneOptimizerParameters;
  2073. particles?: ISceneOptimizerParameters;
  2074. renderTarget?: ISceneOptimizerParameters;
  2075. mergeMeshes?: ISceneOptimizerParameters;
  2076. };
  2077. custom?: string;
  2078. }
  2079. export interface ISceneOptimizerParameters {
  2080. priority?: number;
  2081. maximumSize?: number;
  2082. step?: number;
  2083. }
  2084. }
  2085. declare module BabylonViewer {
  2086. export interface ISkyboxConfiguration {
  2087. cubeTexture?: {
  2088. noMipMap?: boolean;
  2089. gammaSpace?: boolean;
  2090. url?: string | Array<string>;
  2091. };
  2092. color?: {
  2093. r: number;
  2094. g: number;
  2095. b: number;
  2096. };
  2097. pbr?: boolean;
  2098. scale?: number;
  2099. blur?: number;
  2100. material?: {
  2101. imageProcessingConfiguration?: IImageProcessingConfiguration;
  2102. [propName: string]: any;
  2103. };
  2104. infiniteDistance?: boolean;
  2105. }
  2106. }
  2107. declare module BabylonViewer {
  2108. /**
  2109. * A single template configuration object
  2110. */
  2111. export interface ITemplateConfiguration {
  2112. /**
  2113. * can be either the id of the template's html element or a URL.
  2114. * See - http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
  2115. */
  2116. location?: string;
  2117. /**
  2118. * If no location is provided you can provide here the raw html of this template.
  2119. * See http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
  2120. */
  2121. html?: string;
  2122. id?: string;
  2123. /**
  2124. * Parameters that will be delivered to the template and will render it accordingly.
  2125. */
  2126. params?: {
  2127. [key: string]: string | number | boolean | object;
  2128. };
  2129. /**
  2130. * Events to attach to this template.
  2131. * event name is the key. the value can either be a boolean (attach to the parent element)
  2132. * or a map of html id elements.
  2133. *
  2134. * See - http://doc.babylonjs.com/extensions/the_templating_system#event-binding
  2135. */
  2136. events?: {
  2137. pointerdown?: boolean | {
  2138. [id: string]: boolean;
  2139. };
  2140. pointerup?: boolean | {
  2141. [id: string]: boolean;
  2142. };
  2143. pointermove?: boolean | {
  2144. [id: string]: boolean;
  2145. };
  2146. pointerover?: boolean | {
  2147. [id: string]: boolean;
  2148. };
  2149. pointerout?: boolean | {
  2150. [id: string]: boolean;
  2151. };
  2152. pointerenter?: boolean | {
  2153. [id: string]: boolean;
  2154. };
  2155. pointerleave?: boolean | {
  2156. [id: string]: boolean;
  2157. };
  2158. pointercancel?: boolean | {
  2159. [id: string]: boolean;
  2160. };
  2161. click?: boolean | {
  2162. [id: string]: boolean;
  2163. };
  2164. dragstart?: boolean | {
  2165. [id: string]: boolean;
  2166. };
  2167. drop?: boolean | {
  2168. [id: string]: boolean;
  2169. };
  2170. [key: string]: boolean | {
  2171. [id: string]: boolean;
  2172. } | undefined;
  2173. };
  2174. }
  2175. }
  2176. declare module BabylonViewer {
  2177. export interface IVRConfiguration {
  2178. disabled?: boolean;
  2179. objectScaleFactor?: number;
  2180. disableInteractions?: boolean;
  2181. disableTeleportation?: boolean;
  2182. overrideFloorMeshName?: string;
  2183. vrOptions?: BABYLON.VRExperienceHelperOptions;
  2184. modelHeightCorrection?: number | boolean;
  2185. rotateUsingControllers?: boolean;
  2186. cameraPosition?: {
  2187. x: number;
  2188. y: number;
  2189. z: number;
  2190. };
  2191. }
  2192. }
  2193. declare module BabylonViewer {
  2194. /**
  2195. * Spherical polynomial coefficients (counter part to spherical harmonic coefficients used in shader irradiance calculation)
  2196. * @ignoreChildren
  2197. */
  2198. export interface SphericalPolynomalCoefficients {
  2199. x: BABYLON.Vector3;
  2200. y: BABYLON.Vector3;
  2201. z: BABYLON.Vector3;
  2202. xx: BABYLON.Vector3;
  2203. yy: BABYLON.Vector3;
  2204. zz: BABYLON.Vector3;
  2205. yz: BABYLON.Vector3;
  2206. zx: BABYLON.Vector3;
  2207. xy: BABYLON.Vector3;
  2208. }
  2209. /**
  2210. * Wraps data and maps required for environments with physically based rendering
  2211. */
  2212. export interface PBREnvironment {
  2213. /**
  2214. * Spherical Polynomial Coefficients representing an irradiance map
  2215. */
  2216. irradiancePolynomialCoefficients: SphericalPolynomalCoefficients;
  2217. /**
  2218. * Specular cubemap
  2219. */
  2220. specularTexture?: TextureCube;
  2221. /**
  2222. * A scale factor applied to RGB values after reading from environment maps
  2223. */
  2224. textureIntensityScale: number;
  2225. }
  2226. /**
  2227. * Environment map representations: layouts, projections and approximations
  2228. */
  2229. export type MapType = 'irradiance_sh_coefficients_9' | 'cubemap_faces';
  2230. /**
  2231. * Image type used for environment map
  2232. */
  2233. export type ImageType = 'png';
  2234. /**
  2235. * A generic field in JSON that report's its type
  2236. */
  2237. export interface TypedObject<T> {
  2238. type: T;
  2239. }
  2240. /**
  2241. * Describes a range of bytes starting at byte pos (inclusive) and finishing at byte pos + length - 1
  2242. */
  2243. export interface ByteRange {
  2244. pos: number;
  2245. length: number;
  2246. }
  2247. /**
  2248. * Complete Spectre Environment JSON Descriptor
  2249. */
  2250. export interface EnvJsonDescriptor {
  2251. radiance: TypedObject<MapType>;
  2252. irradiance: TypedObject<MapType>;
  2253. specular: TypedObject<MapType>;
  2254. }
  2255. /**
  2256. * Spherical harmonic coefficients to provide an irradiance map
  2257. */
  2258. export interface IrradianceSHCoefficients9 extends TypedObject<MapType> {
  2259. l00: Array<number>;
  2260. l1_1: Array<number>;
  2261. l10: Array<number>;
  2262. l11: Array<number>;
  2263. l2_2: Array<number>;
  2264. l2_1: Array<number>;
  2265. l20: Array<number>;
  2266. l21: Array<number>;
  2267. l22: Array<number>;
  2268. }
  2269. /**
  2270. * A generic set of images, where the image content is specified by byte ranges in the mipmaps field
  2271. */
  2272. export interface ImageSet<T> extends TypedObject<MapType> {
  2273. imageType: ImageType;
  2274. width: number;
  2275. height: number;
  2276. mipmaps: Array<T>;
  2277. multiplier: number;
  2278. }
  2279. /**
  2280. * A set of cubemap faces
  2281. */
  2282. export type CubemapFaces = ImageSet<Array<ByteRange>>;
  2283. /**
  2284. * A single image containing an atlas of equirectangular-projection maps across all mip levels
  2285. */
  2286. export type EquirectangularMipmapAtlas = ImageSet<ByteRange>;
  2287. /**
  2288. * A static class proving methods to aid parsing Spectre environment files
  2289. */
  2290. export class EnvironmentDeserializer {
  2291. /**
  2292. * Parses an arraybuffer into a new PBREnvironment object
  2293. * @param arrayBuffer The arraybuffer of the Spectre environment file
  2294. * @return a PBREnvironment object
  2295. */
  2296. static Parse(arrayBuffer: ArrayBuffer): PBREnvironment;
  2297. }
  2298. }
  2299. declare module BabylonViewer {
  2300. /**
  2301. * WebGL Pixel Formats
  2302. */
  2303. export const enum PixelFormat {
  2304. DEPTH_COMPONENT = 6402,
  2305. ALPHA = 6406,
  2306. RGB = 6407,
  2307. RGBA = 6408,
  2308. LUMINANCE = 6409,
  2309. LUMINANCE_ALPHA = 6410
  2310. }
  2311. /**
  2312. * WebGL Pixel Types
  2313. */
  2314. export const enum PixelType {
  2315. UNSIGNED_BYTE = 5121,
  2316. UNSIGNED_SHORT_4_4_4_4 = 32819,
  2317. UNSIGNED_SHORT_5_5_5_1 = 32820,
  2318. UNSIGNED_SHORT_5_6_5 = 33635
  2319. }
  2320. /**
  2321. * WebGL Texture Magnification Filter
  2322. */
  2323. export const enum TextureMagFilter {
  2324. NEAREST = 9728,
  2325. LINEAR = 9729
  2326. }
  2327. /**
  2328. * WebGL Texture Minification Filter
  2329. */
  2330. export const enum TextureMinFilter {
  2331. NEAREST = 9728,
  2332. LINEAR = 9729,
  2333. NEAREST_MIPMAP_NEAREST = 9984,
  2334. LINEAR_MIPMAP_NEAREST = 9985,
  2335. NEAREST_MIPMAP_LINEAR = 9986,
  2336. LINEAR_MIPMAP_LINEAR = 9987
  2337. }
  2338. /**
  2339. * WebGL Texture Wrap Modes
  2340. */
  2341. export const enum TextureWrapMode {
  2342. REPEAT = 10497,
  2343. CLAMP_TO_EDGE = 33071,
  2344. MIRRORED_REPEAT = 33648
  2345. }
  2346. /**
  2347. * Raw texture data and descriptor sufficient for WebGL texture upload
  2348. */
  2349. export interface TextureData {
  2350. /**
  2351. * Width of image
  2352. */
  2353. width: number;
  2354. /**
  2355. * Height of image
  2356. */
  2357. height: number;
  2358. /**
  2359. * Format of pixels in data
  2360. */
  2361. format: PixelFormat;
  2362. /**
  2363. * Row byte alignment of pixels in data
  2364. */
  2365. alignment: number;
  2366. /**
  2367. * Pixel data
  2368. */
  2369. data: ArrayBufferView;
  2370. }
  2371. /**
  2372. * Wraps sampling parameters for a WebGL texture
  2373. */
  2374. export interface SamplingParameters {
  2375. /**
  2376. * Magnification mode when upsampling from a WebGL texture
  2377. */
  2378. magFilter?: TextureMagFilter;
  2379. /**
  2380. * Minification mode when upsampling from a WebGL texture
  2381. */
  2382. minFilter?: TextureMinFilter;
  2383. /**
  2384. * X axis wrapping mode when sampling out of a WebGL texture bounds
  2385. */
  2386. wrapS?: TextureWrapMode;
  2387. /**
  2388. * Y axis wrapping mode when sampling out of a WebGL texture bounds
  2389. */
  2390. wrapT?: TextureWrapMode;
  2391. /**
  2392. * Anisotropic filtering samples
  2393. */
  2394. maxAnisotropy?: number;
  2395. }
  2396. /**
  2397. * Represents a valid WebGL texture source for use in texImage2D
  2398. */
  2399. export type TextureSource = TextureData | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
  2400. /**
  2401. * A generic set of texture mipmaps (where index 0 has the largest dimension)
  2402. */
  2403. export type Mipmaps<T> = Array<T>;
  2404. /**
  2405. * A set of 6 cubemap arranged in the order [+x, -x, +y, -y, +z, -z]
  2406. */
  2407. export type Faces<T> = Array<T>;
  2408. /**
  2409. * A set of texture mipmaps specifically for 2D textures in WebGL (where index 0 has the largest dimension)
  2410. */
  2411. export type Mipmaps2D = Mipmaps<TextureSource>;
  2412. /**
  2413. * A set of texture mipmaps specifically for cubemap textures in WebGL (where index 0 has the largest dimension)
  2414. */
  2415. export type MipmapsCube = Mipmaps<Faces<TextureSource>>;
  2416. /**
  2417. * A minimal WebGL cubemap descriptor
  2418. */
  2419. export class TextureCube {
  2420. internalFormat: PixelFormat;
  2421. type: PixelType;
  2422. source: MipmapsCube;
  2423. /**
  2424. * Returns the width of a face of the texture or 0 if not available
  2425. */
  2426. readonly Width: number;
  2427. /**
  2428. * Returns the height of a face of the texture or 0 if not available
  2429. */
  2430. readonly Height: number;
  2431. /**
  2432. * constructor
  2433. * @param internalFormat WebGL pixel format for the texture on the GPU
  2434. * @param type WebGL pixel type of the supplied data and texture on the GPU
  2435. * @param source An array containing mipmap levels of faces, where each mipmap level is an array of faces and each face is a TextureSource object
  2436. */
  2437. constructor(internalFormat: PixelFormat, type: PixelType, source?: MipmapsCube);
  2438. }
  2439. /**
  2440. * A static class providing methods to aid working with Bablyon textures.
  2441. */
  2442. export class TextureUtils {
  2443. /**
  2444. * A prefix used when storing a babylon texture object reference on a Spectre texture object
  2445. */
  2446. static BabylonTextureKeyPrefix: string;
  2447. /**
  2448. * Controls anisotropic filtering for deserialized textures.
  2449. */
  2450. static MaxAnisotropy: number;
  2451. /**
  2452. * Returns a BabylonCubeTexture instance from a Spectre texture cube, subject to sampling parameters.
  2453. * If such a texture has already been requested in the past, this texture will be returned, otherwise a new one will be created.
  2454. * The advantage of this is to enable working with texture objects without the need to initialize on the GPU until desired.
  2455. * @param scene A Babylon BABYLON.Scene instance
  2456. * @param textureCube A Spectre TextureCube object
  2457. * @param parameters WebGL texture sampling parameters
  2458. * @param automaticMipmaps Pass true to enable automatic mipmap generation where possible (requires power of images)
  2459. * @param environment Specifies that the texture will be used as an environment
  2460. * @param singleLod Specifies that the texture will be a singleLod (for environment)
  2461. * @return Babylon cube texture
  2462. */
  2463. static GetBabylonCubeTexture(scene: BABYLON.Scene, textureCube: TextureCube, automaticMipmaps: boolean, environment?: boolean, singleLod?: boolean): BABYLON.CubeTexture;
  2464. /**
  2465. * Applies Spectre SamplingParameters to a Babylon texture by directly setting texture parameters on the internal WebGLTexture as well as setting Babylon fields
  2466. * @param babylonTexture Babylon texture to apply texture to (requires the Babylon texture has an initialize _texture field)
  2467. * @param parameters Spectre SamplingParameters to apply
  2468. */
  2469. static ApplySamplingParameters(babylonTexture: BABYLON.BaseTexture, parameters: SamplingParameters): void;
  2470. /**
  2471. * Environment preprocessing dedicated value (Internal Use or Advanced only).
  2472. */
  2473. static EnvironmentLODScale: number;
  2474. /**
  2475. * Environment preprocessing dedicated value (Internal Use or Advanced only)..
  2476. */
  2477. static EnvironmentLODOffset: number;
  2478. }
  2479. }