babylon.viewer.d.ts 102 KB

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