babylon.viewer.d.ts 102 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589
  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 _buttonName: string;
  903. protected _buttonClass: string;
  904. protected _htmlTemplate: string;
  905. constructor(buttonName: string, buttonClass?: string, htmlTemplate?: string);
  906. interactionPredicate(event: EventCallback): boolean;
  907. abstract onEvent(event: EventCallback): void;
  908. addHTMLTemplate(template: Template): void;
  909. protected _generateHTMLElement(template: Template): Element | DocumentFragment;
  910. }
  911. }
  912. declare module BabylonViewer {
  913. /**
  914. *
  915. * @param name the name of the custom optimizer configuration
  916. * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
  917. */
  918. export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
  919. export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
  920. }
  921. declare module BabylonViewer {
  922. /**
  923. * Will attach an init function the the DOMContentLoaded event.
  924. * The init function will be removed automatically after the event was triggered.
  925. */
  926. export function initListeners(): void;
  927. /**
  928. * Select all HTML tags on the page that match the selector and initialize a viewer
  929. *
  930. * @param selector the selector to initialize the viewer on (default is 'babylon')
  931. */
  932. export function InitTags(selector?: string): void;
  933. }
  934. declare module BabylonViewer {
  935. export * from 'babylonjs-viewer/configuration/configuration';
  936. export * from 'babylonjs-viewer/configuration/interfaces';
  937. }
  938. declare module BabylonViewer {
  939. export function getConfigurationKey(key: string, configObject: any): any;
  940. export interface ViewerConfiguration {
  941. version?: string;
  942. extends?: string;
  943. pageUrl?: string;
  944. configuration?: string | {
  945. url?: string;
  946. payload?: any;
  947. mapper?: string;
  948. };
  949. observers?: IObserversConfiguration;
  950. canvasElement?: string;
  951. model?: IModelConfiguration | string;
  952. scene?: ISceneConfiguration;
  953. optimizer?: ISceneOptimizerConfiguration | boolean;
  954. camera?: ICameraConfiguration;
  955. skybox?: boolean | ISkyboxConfiguration;
  956. ground?: boolean | IGroundConfiguration;
  957. lights?: {
  958. [name: string]: number | boolean | ILightConfiguration;
  959. };
  960. engine?: {
  961. renderInBackground?: boolean;
  962. antialiasing?: boolean;
  963. disableResize?: boolean;
  964. engineOptions?: BABYLON.EngineOptions;
  965. adaptiveQuality?: boolean;
  966. hdEnabled?: boolean;
  967. };
  968. templates?: {
  969. main: ITemplateConfiguration;
  970. [key: string]: ITemplateConfiguration;
  971. };
  972. customShaders?: {
  973. shaders?: {
  974. [key: string]: string;
  975. };
  976. includes?: {
  977. [key: string]: string;
  978. };
  979. };
  980. loaderPlugins?: {
  981. extendedMaterial?: boolean;
  982. msftLod?: boolean;
  983. telemetry?: boolean;
  984. minecraft?: boolean;
  985. [propName: string]: boolean | undefined;
  986. };
  987. vr?: IVRConfiguration;
  988. lab?: {
  989. flashlight?: boolean | {
  990. exponent?: number;
  991. angle?: number;
  992. intensity?: number;
  993. diffuse?: {
  994. r: number;
  995. g: number;
  996. b: number;
  997. };
  998. specular?: {
  999. r: number;
  1000. g: number;
  1001. b: number;
  1002. };
  1003. };
  1004. hideLoadingDelay?: number;
  1005. assetsRootURL?: string;
  1006. environmentMainColor?: {
  1007. r: number;
  1008. g: number;
  1009. b: number;
  1010. };
  1011. environmentMap?: {
  1012. /**
  1013. * Environment map texture path in relative to the asset folder.
  1014. */
  1015. texture: string;
  1016. /**
  1017. * Default rotation to apply to the environment map.
  1018. */
  1019. rotationY: number;
  1020. /**
  1021. * Tint level of the main color on the environment map.
  1022. */
  1023. tintLevel: number;
  1024. };
  1025. defaultRenderingPipelines?: boolean | IDefaultRenderingPipelineConfiguration;
  1026. globalLightRotation?: number;
  1027. };
  1028. }
  1029. }
  1030. declare module BabylonViewer {
  1031. /**
  1032. * The object sent when an event is triggered
  1033. */
  1034. export interface EventCallback {
  1035. event: Event;
  1036. template: Template;
  1037. selector: string;
  1038. payload?: any;
  1039. }
  1040. /**
  1041. * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
  1042. * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
  1043. */
  1044. export class TemplateManager {
  1045. containerElement: HTMLElement;
  1046. /**
  1047. * Will be triggered when any template is initialized
  1048. */
  1049. onTemplateInit: BABYLON.Observable<Template>;
  1050. /**
  1051. * Will be triggered when any template is fully loaded
  1052. */
  1053. onTemplateLoaded: BABYLON.Observable<Template>;
  1054. /**
  1055. * Will be triggered when a template state changes
  1056. */
  1057. onTemplateStateChange: BABYLON.Observable<Template>;
  1058. /**
  1059. * Will be triggered when all templates finished loading
  1060. */
  1061. onAllLoaded: BABYLON.Observable<TemplateManager>;
  1062. /**
  1063. * Will be triggered when any event on any template is triggered.
  1064. */
  1065. onEventTriggered: BABYLON.Observable<EventCallback>;
  1066. /**
  1067. * This template manager's event manager. In charge of callback registrations to native event types
  1068. */
  1069. eventManager: EventManager;
  1070. constructor(containerElement: HTMLElement);
  1071. /**
  1072. * Initialize the template(s) for the viewer. Called bay the Viewer class
  1073. * @param templates the templates to be used to initialize the main template
  1074. */
  1075. initTemplate(templates: {
  1076. [key: string]: ITemplateConfiguration;
  1077. }): Promise<void>;
  1078. /**
  1079. * Get the canvas in the template tree.
  1080. * There must be one and only one canvas inthe template.
  1081. */
  1082. getCanvas(): HTMLCanvasElement | null;
  1083. /**
  1084. * Get a specific template from the template tree
  1085. * @param name the name of the template to load
  1086. */
  1087. getTemplate(name: string): Template | undefined;
  1088. /**
  1089. * Dispose the template manager
  1090. */
  1091. dispose(): void;
  1092. }
  1093. /**
  1094. * This class represents a single template in the viewer's template tree.
  1095. * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
  1096. * A template is injected using the template manager in the correct position.
  1097. * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
  1098. *
  1099. * For further information please refer to the documentation page, https://doc.babylonjs.com
  1100. */
  1101. export class Template {
  1102. name: string;
  1103. /**
  1104. * Will be triggered when the template is loaded
  1105. */
  1106. onLoaded: BABYLON.Observable<Template>;
  1107. /**
  1108. * will be triggered when the template is appended to the tree
  1109. */
  1110. onAppended: BABYLON.Observable<Template>;
  1111. /**
  1112. * Will be triggered when the template's state changed (shown, hidden)
  1113. */
  1114. onStateChange: BABYLON.Observable<Template>;
  1115. /**
  1116. * Will be triggered when an event is triggered on ths template.
  1117. * The event is a native browser event (like mouse or pointer events)
  1118. */
  1119. onEventTriggered: BABYLON.Observable<EventCallback>;
  1120. onParamsUpdated: BABYLON.Observable<Template>;
  1121. onHTMLRendered: BABYLON.Observable<Template>;
  1122. /**
  1123. * is the template loaded?
  1124. */
  1125. isLoaded: boolean;
  1126. /**
  1127. * This is meant to be used to track the show and hide functions.
  1128. * This is NOT (!!) a flag to check if the element is actually visible to the user.
  1129. */
  1130. isShown: boolean;
  1131. /**
  1132. * Is this template a part of the HTML tree (the template manager injected it)
  1133. */
  1134. isInHtmlTree: boolean;
  1135. /**
  1136. * The HTML element containing this template
  1137. */
  1138. parent: HTMLElement;
  1139. /**
  1140. * A promise that is fulfilled when the template finished loading.
  1141. */
  1142. initPromise: Promise<Template>;
  1143. constructor(name: string, _configuration: ITemplateConfiguration);
  1144. /**
  1145. * Some templates have parameters (like background color for example).
  1146. * The parameters are provided to Handlebars which in turn generates the template.
  1147. * This function will update the template with the new parameters
  1148. *
  1149. * Note that when updating parameters the events will be registered again (after being cleared).
  1150. *
  1151. * @param params the new template parameters
  1152. */
  1153. updateParams(params: {
  1154. [key: string]: string | number | boolean | object;
  1155. }, append?: boolean): void;
  1156. redraw(): void;
  1157. /**
  1158. * Get the template'S configuration
  1159. */
  1160. readonly configuration: ITemplateConfiguration;
  1161. /**
  1162. * A template can be a parent element for other templates or HTML elements.
  1163. * This function will deliver all child HTML elements of this template.
  1164. */
  1165. getChildElements(): Array<string>;
  1166. /**
  1167. * Appending the template to a parent HTML element.
  1168. * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
  1169. * @param parent the parent to which the template is added
  1170. * @param forceRemove if the parent already exists, shoud the template be removed from it?
  1171. */
  1172. appendTo(parent: HTMLElement, forceRemove?: boolean): void;
  1173. /**
  1174. * Show the template using the provided visibilityFunction, or natively using display: flex.
  1175. * The provided function returns a promise that should be fullfilled when the element is shown.
  1176. * Since it is a promise async operations are more than possible.
  1177. * See the default viewer for an opacity example.
  1178. * @param visibilityFunction The function to execute to show the template.
  1179. */
  1180. show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1181. /**
  1182. * Hide the template using the provided visibilityFunction, or natively using display: none.
  1183. * The provided function returns a promise that should be fullfilled when the element is hidden.
  1184. * Since it is a promise async operations are more than possible.
  1185. * See the default viewer for an opacity example.
  1186. * @param visibilityFunction The function to execute to show the template.
  1187. */
  1188. hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
  1189. /**
  1190. * Dispose this template
  1191. */
  1192. dispose(): void;
  1193. }
  1194. }
  1195. declare module BabylonViewer {
  1196. export class ConfigurationContainer {
  1197. configuration: ViewerConfiguration;
  1198. viewerId: string;
  1199. mainColor: BABYLON.Color3;
  1200. reflectionColor: BABYLON.Color3;
  1201. scene?: BABYLON.Scene;
  1202. }
  1203. }
  1204. declare module BabylonViewer {
  1205. /**
  1206. * The configuration loader will load the configuration object from any source and will use the defined mapper to
  1207. * parse the object and return a conform ViewerConfiguration.
  1208. * It is a private member of the scene.
  1209. */
  1210. export class ConfigurationLoader {
  1211. constructor(_enableCache?: boolean);
  1212. /**
  1213. * load a configuration object that is defined in the initial configuration provided.
  1214. * The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
  1215. *
  1216. * @param initConfig the initial configuration that has the definitions of further configuration to load.
  1217. * @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
  1218. * @returns A promise that delivers the extended viewer configuration, when done.
  1219. */
  1220. loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
  1221. /**
  1222. * Dispose the configuration loader. This will cancel file requests, if active.
  1223. */
  1224. dispose(): void;
  1225. }
  1226. }
  1227. declare module BabylonViewer {
  1228. export class ObservablesManager {
  1229. /**
  1230. * Will notify when the scene was initialized
  1231. */
  1232. onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  1233. /**
  1234. * will notify when the engine was initialized
  1235. */
  1236. onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
  1237. /**
  1238. * Will notify when a new model was added to the scene.
  1239. * Note that added does not neccessarily mean loaded!
  1240. */
  1241. onModelAddedObservable: BABYLON.Observable<ViewerModel>;
  1242. /**
  1243. * will notify after every model load
  1244. */
  1245. onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
  1246. /**
  1247. * will notify when any model notify of progress
  1248. */
  1249. onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
  1250. /**
  1251. * will notify when any model load failed.
  1252. */
  1253. onModelLoadErrorObservable: BABYLON.Observable<{
  1254. message: string;
  1255. exception: any;
  1256. }>;
  1257. /**
  1258. * Will notify when a model was removed from the scene;
  1259. */
  1260. onModelRemovedObservable: BABYLON.Observable<ViewerModel>;
  1261. /**
  1262. * will notify when a new loader was initialized.
  1263. * Used mainly to know when a model starts loading.
  1264. */
  1265. onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
  1266. /**
  1267. * Observers registered here will be executed when the entire load process has finished.
  1268. */
  1269. onViewerInitDoneObservable: BABYLON.Observable<any>;
  1270. /**
  1271. * Will notify when the viewer init started (after configuration was loaded)
  1272. */
  1273. onViewerInitStartedObservable: BABYLON.Observable<any>;
  1274. /**
  1275. * Functions added to this observable will be executed on each frame rendered.
  1276. */
  1277. onFrameRenderedObservable: BABYLON.Observable<any>;
  1278. constructor();
  1279. dispose(): void;
  1280. }
  1281. }
  1282. declare module BabylonViewer {
  1283. /**
  1284. * This interface describes the structure of the variable sent with the configuration observables of the scene manager.
  1285. * O - the type of object we are dealing with (Light, BABYLON.ArcRotateCamera, BABYLON.Scene, etc')
  1286. * T - the configuration type
  1287. */
  1288. export interface IPostConfigurationCallback<OBJ, CONF> {
  1289. newConfiguration: CONF;
  1290. sceneManager: SceneManager;
  1291. object: OBJ;
  1292. model?: ViewerModel;
  1293. }
  1294. export class SceneManager {
  1295. /**
  1296. * Will notify when the scene was initialized
  1297. */
  1298. onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
  1299. /**
  1300. * Will notify after the scene was configured. Can be used to further configure the scene
  1301. */
  1302. onSceneConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.Scene, ISceneConfiguration>>;
  1303. /**
  1304. * Will notify after the scene optimized was configured. Can be used to further configure the scene optimizer
  1305. */
  1306. onSceneOptimizerConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.SceneOptimizer, ISceneOptimizerConfiguration | boolean>>;
  1307. /**
  1308. * Will notify after the camera was configured. Can be used to further configure the camera
  1309. */
  1310. onCameraConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.ArcRotateCamera, ICameraConfiguration>>;
  1311. /**
  1312. * Will notify after the lights were configured. Can be used to further configure lights
  1313. */
  1314. onLightsConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<Array<BABYLON.Light>, {
  1315. [name: string]: ILightConfiguration | boolean | number;
  1316. }>>;
  1317. /**
  1318. * Will notify after the model(s) were configured. Can be used to further configure models
  1319. */
  1320. onModelsConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<Array<ViewerModel>, IModelConfiguration>>;
  1321. /**
  1322. * Will notify after the envirnoment was configured. Can be used to further configure the environment
  1323. */
  1324. onEnvironmentConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.EnvironmentHelper, {
  1325. skybox?: ISkyboxConfiguration | boolean;
  1326. ground?: IGroundConfiguration | boolean;
  1327. }>>;
  1328. /**
  1329. * Will notify after the model(s) were configured. Can be used to further configure models
  1330. */
  1331. onVRConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<BABYLON.VRExperienceHelper, IVRConfiguration>>;
  1332. /**
  1333. * The Babylon BABYLON.Scene of this viewer
  1334. */
  1335. scene: BABYLON.Scene;
  1336. /**
  1337. * The camera used in this viewer
  1338. */
  1339. camera: BABYLON.ArcRotateCamera;
  1340. /**
  1341. * Babylon's scene optimizer
  1342. */
  1343. sceneOptimizer: BABYLON.SceneOptimizer;
  1344. /**
  1345. * Models displayed in this viewer.
  1346. */
  1347. models: Array<ViewerModel>;
  1348. /**
  1349. * Babylon's environment helper of this viewer
  1350. */
  1351. environmentHelper?: BABYLON.EnvironmentHelper;
  1352. protected _defaultHighpTextureType: number;
  1353. protected _shadowGeneratorBias: number;
  1354. protected _defaultPipelineTextureType: number;
  1355. /**
  1356. * The maximum number of shadows supported by the curent viewer
  1357. */
  1358. protected _maxShadows: number;
  1359. /**
  1360. * The labs variable consists of objects that will have their API change.
  1361. * Please be careful when using labs in production.
  1362. */
  1363. labs: ViewerLabs;
  1364. readonly defaultRenderingPipeline: BABYLON.Nullable<BABYLON.DefaultRenderingPipeline>;
  1365. protected _vrHelper?: BABYLON.VRExperienceHelper;
  1366. readonly vrHelper: BABYLON.VRExperienceHelper | undefined;
  1367. constructor(_engine: BABYLON.Engine, _configurationContainer: ConfigurationContainer, _observablesManager?: ObservablesManager | undefined);
  1368. /**
  1369. * Returns a boolean representing HDR support
  1370. */
  1371. readonly isHdrSupported: boolean;
  1372. /**
  1373. * Return the main color defined in the configuration.
  1374. */
  1375. readonly mainColor: BABYLON.Color3;
  1376. readonly reflectionColor: BABYLON.Color3;
  1377. animationBlendingEnabled: boolean;
  1378. readonly observablesManager: ObservablesManager | undefined;
  1379. /**
  1380. * Should shadows be rendered every frame, or only once and stop.
  1381. * This can be used to optimize a scene.
  1382. *
  1383. * Not that the shadows will NOT disapear but will remain in place.
  1384. * @param process if true shadows will be updated once every frame. if false they will stop being updated.
  1385. */
  1386. processShadows: boolean;
  1387. groundEnabled: boolean;
  1388. /**
  1389. * sets wether the reflection is disabled.
  1390. */
  1391. groundMirrorEnabled: boolean;
  1392. defaultRenderingPipelineEnabled: boolean;
  1393. /**
  1394. * Sets the engine flags to unlock all babylon features.
  1395. * Can also be configured using the scene.flags configuration object
  1396. */
  1397. unlockBabylonFeatures(): void;
  1398. /**
  1399. * initialize the scene. Calling this function again will dispose the old scene, if exists.
  1400. */
  1401. initScene(sceneConfiguration?: ISceneConfiguration, optimizerConfiguration?: boolean | ISceneOptimizerConfiguration): Promise<BABYLON.Scene>;
  1402. clearScene(clearModels?: boolean, clearLights?: boolean): void;
  1403. /**
  1404. * This will update the scene's configuration, including camera, lights, environment.
  1405. * @param newConfiguration the delta that should be configured. This includes only the changes
  1406. * @param globalConfiguration The global configuration object, after the new configuration was merged into it
  1407. */
  1408. updateConfiguration(newConfiguration: Partial<ViewerConfiguration>): void;
  1409. bloomEnabled: boolean;
  1410. fxaaEnabled: boolean;
  1411. /**
  1412. * internally configure the scene using the provided configuration.
  1413. * The scene will not be recreated, but just updated.
  1414. * @param sceneConfig the (new) scene configuration
  1415. */
  1416. protected _configureScene(sceneConfig: ISceneConfiguration): void;
  1417. /**
  1418. * Configure the scene optimizer.
  1419. * The existing scene optimizer will be disposed and a new one will be created.
  1420. * @param optimizerConfig the (new) optimizer configuration
  1421. */
  1422. protected _configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
  1423. /**
  1424. * configure all models using the configuration.
  1425. * @param modelConfiguration the configuration to use to reconfigure the models
  1426. */
  1427. protected _configureVR(vrConfig: IVRConfiguration): void;
  1428. /**
  1429. * (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
  1430. * @param cameraConfig the new camera configuration
  1431. * @param model optionally use the model to configure the camera.
  1432. */
  1433. protected _configureCamera(cameraConfig?: ICameraConfiguration): void;
  1434. protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void;
  1435. /**
  1436. * configure the lights.
  1437. *
  1438. * @param lightsConfiguration the (new) light(s) configuration
  1439. * @param model optionally use the model to configure the camera.
  1440. */
  1441. protected _configureLights(lightsConfiguration?: {
  1442. [name: string]: ILightConfiguration | boolean | number;
  1443. }): void;
  1444. /**
  1445. * Gets the shadow map blur kernel according to the light configuration.
  1446. * @param light The light used to generate the shadows
  1447. * @param bufferSize The size of the shadow map
  1448. * @return the kernel blur size
  1449. */
  1450. getBlurKernel(light: BABYLON.IShadowLight, bufferSize: number): number;
  1451. /**
  1452. * Alters render settings to reduce features based on hardware feature limitations
  1453. * @param enableHDR Allows the viewer to run in HDR mode.
  1454. */
  1455. protected _handleHardwareLimitations(enableHDR?: boolean): void;
  1456. /**
  1457. * Dispoe the entire viewer including the scene and the engine
  1458. */
  1459. dispose(): void;
  1460. }
  1461. }
  1462. declare module BabylonViewer {
  1463. export interface IModelConfiguration {
  1464. id?: string;
  1465. url?: string;
  1466. root?: string;
  1467. file?: string | File;
  1468. loader?: string;
  1469. position?: {
  1470. x: number;
  1471. y: number;
  1472. z: number;
  1473. };
  1474. rotation?: {
  1475. x: number;
  1476. y: number;
  1477. z: number;
  1478. w?: number;
  1479. };
  1480. scaling?: {
  1481. x: number;
  1482. y: number;
  1483. z: number;
  1484. };
  1485. parentObjectIndex?: number;
  1486. castShadow?: boolean;
  1487. receiveShadows?: boolean;
  1488. normalize?: boolean | {
  1489. center?: boolean;
  1490. unitSize?: boolean;
  1491. parentIndex?: number;
  1492. };
  1493. title?: string;
  1494. subtitle?: string;
  1495. thumbnail?: string;
  1496. animation?: {
  1497. autoStart?: boolean | string;
  1498. playOnce?: boolean;
  1499. autoStartIndex?: number;
  1500. };
  1501. entryAnimation?: IModelAnimationConfiguration;
  1502. exitAnimation?: IModelAnimationConfiguration;
  1503. material?: {
  1504. directEnabled?: boolean;
  1505. directIntensity?: number;
  1506. emissiveIntensity?: number;
  1507. environmentIntensity?: number;
  1508. [propName: string]: any;
  1509. };
  1510. /**
  1511. * Rotation offset axis definition
  1512. */
  1513. rotationOffsetAxis?: {
  1514. x: number;
  1515. y: number;
  1516. z: number;
  1517. };
  1518. /**
  1519. * the offset angle
  1520. */
  1521. rotationOffsetAngle?: number;
  1522. loaderConfiguration?: {
  1523. maxLODsToLoad?: number;
  1524. progressiveLoading?: boolean;
  1525. };
  1526. }
  1527. }
  1528. declare module BabylonViewer {
  1529. /**
  1530. * Get a loader plugin according to its name.
  1531. * The plugin will be cached and will be reused if called for again.
  1532. *
  1533. * @param name the name of the plugin
  1534. */
  1535. export function getLoaderPluginByName(name: string): ILoaderPlugin;
  1536. /**
  1537. *
  1538. */
  1539. export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
  1540. }
  1541. declare module BabylonViewer {
  1542. export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
  1543. export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
  1544. export * from 'babylonjs-viewer/configuration/interfaces/defaultRenderingPipelineConfiguration';
  1545. export * from 'babylonjs-viewer/configuration/interfaces/groundConfiguration';
  1546. export * from 'babylonjs-viewer/configuration/interfaces/imageProcessingConfiguration';
  1547. export * from 'babylonjs-viewer/configuration/interfaces/lightConfiguration';
  1548. export * from 'babylonjs-viewer/configuration/interfaces/modelAnimationConfiguration';
  1549. export * from 'babylonjs-viewer/configuration/interfaces/modelConfiguration';
  1550. export * from 'babylonjs-viewer/configuration/interfaces/observersConfiguration';
  1551. export * from 'babylonjs-viewer/configuration/interfaces/sceneConfiguration';
  1552. export * from 'babylonjs-viewer/configuration/interfaces/sceneOptimizerConfiguration';
  1553. export * from 'babylonjs-viewer/configuration/interfaces/skyboxConfiguration';
  1554. export * from 'babylonjs-viewer/configuration/interfaces/templateConfiguration';
  1555. export * from 'babylonjs-viewer/configuration/interfaces/vrConfiguration';
  1556. }
  1557. declare module BabylonViewer {
  1558. /**
  1559. * The EventManager is in charge of registering user interctions with the viewer.
  1560. * It is used in the TemplateManager
  1561. */
  1562. export class EventManager {
  1563. constructor(_templateManager: TemplateManager);
  1564. /**
  1565. * Register a new callback to a specific template.
  1566. * The best example for the usage can be found in the DefaultViewer
  1567. *
  1568. * @param templateName the templateName to register the event to
  1569. * @param callback The callback to be executed
  1570. * @param eventType the type of event to register
  1571. * @param selector an optional selector. if not defined the parent object in the template will be selected
  1572. */
  1573. registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1574. /**
  1575. * This will remove a registered event from the defined template.
  1576. * Each one of the variables apart from the template name are optional, but one must be provided.
  1577. *
  1578. * @param templateName the templateName
  1579. * @param callback the callback to remove (optional)
  1580. * @param eventType the event type to remove (optional)
  1581. * @param selector the selector from which to remove the event (optional)
  1582. */
  1583. unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
  1584. /**
  1585. * Dispose the event manager
  1586. */
  1587. dispose(): void;
  1588. }
  1589. }
  1590. declare module BabylonViewer {
  1591. /**
  1592. * The ViewerLabs class will hold functions that are not (!) backwards compatible.
  1593. * The APIs in all labs-related classes and configuration might change.
  1594. * Once stable, lab features will be moved to the publis API and configuration object.
  1595. */
  1596. export class ViewerLabs {
  1597. constructor(_scene: BABYLON.Scene);
  1598. assetsRootURL: string;
  1599. environment: PBREnvironment;
  1600. /**
  1601. * Loads an environment map from a given URL
  1602. * @param url URL of environment map
  1603. * @param onSuccess Callback fired after environment successfully applied to the scene
  1604. * @param onProgress Callback fired at progress events while loading the environment map
  1605. * @param onError Callback fired when the load fails
  1606. */
  1607. loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
  1608. /**
  1609. * Loads an environment map from a given URL
  1610. * @param buffer ArrayBuffer containing environment map
  1611. * @param onSuccess Callback fired after environment successfully applied to the scene
  1612. * @param onProgress Callback fired at progress events while loading the environment map
  1613. * @param onError Callback fired when the load fails
  1614. */
  1615. loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
  1616. /**
  1617. * Sets the environment to an already loaded environment
  1618. * @param env PBREnvironment instance
  1619. * @param onSuccess Callback fired after environment successfully applied to the scene
  1620. * @param onProgress Callback fired at progress events while loading the environment map
  1621. * @param onError Callback fired when the load fails
  1622. */
  1623. loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
  1624. /**
  1625. * Applies an `EnvironmentMapConfiguration` to the scene
  1626. * @param environmentMapConfiguration Environment map configuration to apply
  1627. */
  1628. applyEnvironmentMapConfiguration(rotationY?: number): void;
  1629. /**
  1630. * Get an environment asset url by using the configuration if the path is not absolute.
  1631. * @param url Asset url
  1632. * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
  1633. */
  1634. getAssetUrl(url: string): string;
  1635. rotateShadowLight(shadowLight: BABYLON.ShadowLight, amount: number, point?: BABYLON.Vector3, axis?: BABYLON.Vector3, target?: BABYLON.Vector3): void;
  1636. }
  1637. }
  1638. declare module BabylonViewer {
  1639. /**
  1640. * Defines an animation to be applied to a model (translation, scale or rotation).
  1641. */
  1642. export interface IModelAnimationConfiguration {
  1643. /**
  1644. * Time of animation, in seconds
  1645. */
  1646. time?: number;
  1647. /**
  1648. * Scale to apply
  1649. */
  1650. scaling?: {
  1651. x: number;
  1652. y: number;
  1653. z: number;
  1654. };
  1655. /**
  1656. * Easing function to apply
  1657. */
  1658. easingFunction?: number;
  1659. /**
  1660. * An Easing mode to apply to the easing function
  1661. * See BABYLON.EasingFunction
  1662. */
  1663. easingMode?: number;
  1664. }
  1665. }
  1666. declare module BabylonViewer {
  1667. export class TelemetryLoaderPlugin implements ILoaderPlugin {
  1668. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1669. onLoaded(model: ViewerModel): void;
  1670. onError(message: string, exception: any): void;
  1671. onComplete(): void;
  1672. }
  1673. }
  1674. declare module BabylonViewer {
  1675. /**
  1676. * A loder plugin to use MSFT_lod extension correctly (glTF)
  1677. */
  1678. export class MSFTLodLoaderPlugin implements ILoaderPlugin {
  1679. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1680. onExtensionLoaded(extension: BABYLON.IGLTFLoaderExtension): void;
  1681. }
  1682. }
  1683. declare module BabylonViewer {
  1684. /**
  1685. * Force-apply material configuration right after a material was loaded.
  1686. */
  1687. export class ApplyMaterialConfigPlugin implements ILoaderPlugin {
  1688. onInit(loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync, model: ViewerModel): void;
  1689. onMaterialLoaded(material: BABYLON.Material): void;
  1690. }
  1691. }
  1692. declare module BabylonViewer {
  1693. /**
  1694. * A (PBR) material will be extended using this function.
  1695. * This function will hold extra default configuration for the viewer, if not implemented in Babylon itself.
  1696. */
  1697. export class ExtendedMaterialLoaderPlugin implements ILoaderPlugin {
  1698. onMaterialLoaded(baseMaterial: BABYLON.Material): void;
  1699. }
  1700. }
  1701. declare module BabylonViewer {
  1702. export interface ICameraConfiguration {
  1703. position?: {
  1704. x: number;
  1705. y: number;
  1706. z: number;
  1707. };
  1708. rotation?: {
  1709. x: number;
  1710. y: number;
  1711. z: number;
  1712. w: number;
  1713. };
  1714. fov?: number;
  1715. fovMode?: number;
  1716. minZ?: number;
  1717. maxZ?: number;
  1718. inertia?: number;
  1719. exposure?: number;
  1720. pinchPrecision?: number;
  1721. behaviors?: {
  1722. [name: string]: boolean | number | ICameraBehaviorConfiguration;
  1723. };
  1724. disableCameraControl?: boolean;
  1725. disableCtrlForPanning?: boolean;
  1726. disableAutoFocus?: boolean;
  1727. [propName: string]: any;
  1728. }
  1729. export interface ICameraBehaviorConfiguration {
  1730. type: number;
  1731. [propName: string]: any;
  1732. }
  1733. }
  1734. declare module BabylonViewer {
  1735. /**
  1736. * The Color Grading Configuration groups the different settings used to define the color grading used in the viewer.
  1737. */
  1738. export interface IColorGradingConfiguration {
  1739. /**
  1740. * Transform data string, encoded as determined by transformDataFormat.
  1741. */
  1742. transformData: string;
  1743. /**
  1744. * The encoding format of TransformData (currently only raw-base16 is supported).
  1745. */
  1746. transformDataFormat: string;
  1747. /**
  1748. * The weight of the transform
  1749. */
  1750. transformWeight: number;
  1751. /**
  1752. * Color curve colorFilterHueGlobal value
  1753. */
  1754. colorFilterHueGlobal: number;
  1755. /**
  1756. * Color curve colorFilterHueShadows value
  1757. */
  1758. colorFilterHueShadows: number;
  1759. /**
  1760. * Color curve colorFilterHueMidtones value
  1761. */
  1762. colorFilterHueMidtones: number;
  1763. /**
  1764. * Color curve colorFilterHueHighlights value
  1765. */
  1766. colorFilterHueHighlights: number;
  1767. /**
  1768. * Color curve colorFilterDensityGlobal value
  1769. */
  1770. colorFilterDensityGlobal: number;
  1771. /**
  1772. * Color curve colorFilterDensityShadows value
  1773. */
  1774. colorFilterDensityShadows: number;
  1775. /**
  1776. * Color curve colorFilterDensityMidtones value
  1777. */
  1778. colorFilterDensityMidtones: number;
  1779. /**
  1780. * Color curve colorFilterDensityHighlights value
  1781. */
  1782. colorFilterDensityHighlights: number;
  1783. /**
  1784. * Color curve saturationGlobal value
  1785. */
  1786. saturationGlobal: number;
  1787. /**
  1788. * Color curve saturationShadows value
  1789. */
  1790. saturationShadows: number;
  1791. /**
  1792. * Color curve saturationMidtones value
  1793. */
  1794. saturationMidtones: number;
  1795. /**
  1796. * Color curve saturationHighlights value
  1797. */
  1798. saturationHighlights: number;
  1799. /**
  1800. * Color curve exposureGlobal value
  1801. */
  1802. exposureGlobal: number;
  1803. /**
  1804. * Color curve exposureShadows value
  1805. */
  1806. exposureShadows: number;
  1807. /**
  1808. * Color curve exposureMidtones value
  1809. */
  1810. exposureMidtones: number;
  1811. /**
  1812. * Color curve exposureHighlights value
  1813. */
  1814. exposureHighlights: number;
  1815. }
  1816. }
  1817. declare module BabylonViewer {
  1818. export interface IDefaultRenderingPipelineConfiguration {
  1819. sharpenEnabled?: boolean;
  1820. bloomEnabled?: boolean;
  1821. bloomThreshold?: number;
  1822. depthOfFieldEnabled?: boolean;
  1823. depthOfFieldBlurLevel?: BABYLON.DepthOfFieldEffectBlurLevel;
  1824. fxaaEnabled?: boolean;
  1825. imageProcessingEnabled?: boolean;
  1826. defaultPipelineTextureType?: number;
  1827. bloomScale?: number;
  1828. chromaticAberrationEnabled?: boolean;
  1829. grainEnabled?: boolean;
  1830. bloomKernel?: number;
  1831. hardwareScaleLevel?: number;
  1832. bloomWeight?: number;
  1833. hdr?: boolean;
  1834. samples?: number;
  1835. glowLayerEnabled?: boolean;
  1836. }
  1837. }
  1838. declare module BabylonViewer {
  1839. export interface IGroundConfiguration {
  1840. size?: number;
  1841. receiveShadows?: boolean;
  1842. shadowLevel?: number;
  1843. shadowOnly?: boolean;
  1844. mirror?: boolean | {
  1845. sizeRatio?: number;
  1846. blurKernel?: number;
  1847. amount?: number;
  1848. fresnelWeight?: number;
  1849. fallOffDistance?: number;
  1850. textureType?: number;
  1851. };
  1852. texture?: string;
  1853. color?: {
  1854. r: number;
  1855. g: number;
  1856. b: number;
  1857. };
  1858. opacity?: number;
  1859. material?: {
  1860. [propName: string]: any;
  1861. };
  1862. }
  1863. }
  1864. declare module BabylonViewer {
  1865. export interface IImageProcessingConfiguration {
  1866. colorGradingEnabled?: boolean;
  1867. colorCurvesEnabled?: boolean;
  1868. colorCurves?: {
  1869. globalHue?: number;
  1870. globalDensity?: number;
  1871. globalSaturation?: number;
  1872. globalExposure?: number;
  1873. highlightsHue?: number;
  1874. highlightsDensity?: number;
  1875. highlightsSaturation?: number;
  1876. highlightsExposure?: number;
  1877. midtonesHue?: number;
  1878. midtonesDensity?: number;
  1879. midtonesSaturation?: number;
  1880. midtonesExposure?: number;
  1881. shadowsHue?: number;
  1882. shadowsDensity?: number;
  1883. shadowsSaturation?: number;
  1884. shadowsExposure?: number;
  1885. };
  1886. colorGradingWithGreenDepth?: boolean;
  1887. colorGradingBGR?: boolean;
  1888. exposure?: number;
  1889. toneMappingEnabled?: boolean;
  1890. contrast?: number;
  1891. vignetteEnabled?: boolean;
  1892. vignetteStretch?: number;
  1893. vignetteCentreX?: number;
  1894. vignetteCentreY?: number;
  1895. vignetteWeight?: number;
  1896. vignetteColor?: {
  1897. r: number;
  1898. g: number;
  1899. b: number;
  1900. a?: number;
  1901. };
  1902. vignetteCameraFov?: number;
  1903. vignetteBlendMode?: number;
  1904. vignetteM?: boolean;
  1905. applyByPostProcess?: boolean;
  1906. isEnabled?: boolean;
  1907. }
  1908. }
  1909. declare module BabylonViewer {
  1910. export interface ILightConfiguration {
  1911. type: number;
  1912. name?: string;
  1913. disabled?: boolean;
  1914. position?: {
  1915. x: number;
  1916. y: number;
  1917. z: number;
  1918. };
  1919. target?: {
  1920. x: number;
  1921. y: number;
  1922. z: number;
  1923. };
  1924. direction?: {
  1925. x: number;
  1926. y: number;
  1927. z: number;
  1928. };
  1929. diffuse?: {
  1930. r: number;
  1931. g: number;
  1932. b: number;
  1933. };
  1934. specular?: {
  1935. r: number;
  1936. g: number;
  1937. b: number;
  1938. };
  1939. intensity?: number;
  1940. intensityMode?: number;
  1941. radius?: number;
  1942. shadownEnabled?: boolean;
  1943. shadowConfig?: {
  1944. useBlurExponentialShadowMap?: boolean;
  1945. useBlurCloseExponentialShadowMap?: boolean;
  1946. useKernelBlur?: boolean;
  1947. blurKernel?: number;
  1948. blurScale?: number;
  1949. minZ?: number;
  1950. maxZ?: number;
  1951. frustumSize?: number;
  1952. angleScale?: number;
  1953. frustumEdgeFalloff?: number;
  1954. [propName: string]: any;
  1955. };
  1956. spotAngle?: number;
  1957. shadowFieldOfView?: number;
  1958. shadowBufferSize?: number;
  1959. shadowFrustumSize?: number;
  1960. shadowMinZ?: number;
  1961. shadowMaxZ?: number;
  1962. [propName: string]: any;
  1963. behaviors?: {
  1964. [name: string]: number | {
  1965. type: number;
  1966. [propName: string]: any;
  1967. };
  1968. };
  1969. }
  1970. }
  1971. declare module BabylonViewer {
  1972. export interface IObserversConfiguration {
  1973. onEngineInit?: string;
  1974. onSceneInit?: string;
  1975. onModelLoaded?: string;
  1976. }
  1977. }
  1978. declare module BabylonViewer {
  1979. export interface ISceneConfiguration {
  1980. debug?: boolean;
  1981. clearColor?: {
  1982. r: number;
  1983. g: number;
  1984. b: number;
  1985. a: number;
  1986. };
  1987. mainColor?: {
  1988. r?: number;
  1989. g?: number;
  1990. b?: number;
  1991. };
  1992. imageProcessingConfiguration?: IImageProcessingConfiguration;
  1993. environmentTexture?: string;
  1994. colorGrading?: IColorGradingConfiguration;
  1995. environmentRotationY?: number;
  1996. /**
  1997. * Deprecated, please use default rendering pipeline
  1998. */
  1999. glow?: boolean | BABYLON.IGlowLayerOptions;
  2000. disableHdr?: boolean;
  2001. renderInBackground?: boolean;
  2002. disableCameraControl?: boolean;
  2003. animationPropertiesOverride?: {
  2004. [propName: string]: any;
  2005. };
  2006. defaultMaterial?: {
  2007. materialType: "standard" | "pbr";
  2008. [propName: string]: any;
  2009. };
  2010. flags?: {
  2011. shadowsEnabled?: boolean;
  2012. particlesEnabled?: boolean;
  2013. collisionsEnabled?: boolean;
  2014. lightsEnabled?: boolean;
  2015. texturesEnabled?: boolean;
  2016. lensFlaresEnabled?: boolean;
  2017. proceduralTexturesEnabled?: boolean;
  2018. renderTargetsEnabled?: boolean;
  2019. spritesEnabled?: boolean;
  2020. skeletonsEnabled?: boolean;
  2021. audioEnabled?: boolean;
  2022. };
  2023. }
  2024. }
  2025. declare module BabylonViewer {
  2026. export interface ISceneOptimizerConfiguration {
  2027. targetFrameRate?: number;
  2028. trackerDuration?: number;
  2029. autoGeneratePriorities?: boolean;
  2030. improvementMode?: boolean;
  2031. degradation?: string;
  2032. types?: {
  2033. texture?: ISceneOptimizerParameters;
  2034. hardwareScaling?: ISceneOptimizerParameters;
  2035. shadow?: ISceneOptimizerParameters;
  2036. postProcess?: ISceneOptimizerParameters;
  2037. lensFlare?: ISceneOptimizerParameters;
  2038. particles?: ISceneOptimizerParameters;
  2039. renderTarget?: ISceneOptimizerParameters;
  2040. mergeMeshes?: ISceneOptimizerParameters;
  2041. };
  2042. custom?: string;
  2043. }
  2044. export interface ISceneOptimizerParameters {
  2045. priority?: number;
  2046. maximumSize?: number;
  2047. step?: number;
  2048. }
  2049. }
  2050. declare module BabylonViewer {
  2051. export interface ISkyboxConfiguration {
  2052. cubeTexture?: {
  2053. noMipMap?: boolean;
  2054. gammaSpace?: boolean;
  2055. url?: string | Array<string>;
  2056. };
  2057. color?: {
  2058. r: number;
  2059. g: number;
  2060. b: number;
  2061. };
  2062. pbr?: boolean;
  2063. scale?: number;
  2064. blur?: number;
  2065. material?: {
  2066. imageProcessingConfiguration?: IImageProcessingConfiguration;
  2067. [propName: string]: any;
  2068. };
  2069. infiniteDistance?: boolean;
  2070. }
  2071. }
  2072. declare module BabylonViewer {
  2073. /**
  2074. * A single template configuration object
  2075. */
  2076. export interface ITemplateConfiguration {
  2077. /**
  2078. * can be either the id of the template's html element or a URL.
  2079. * See - http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
  2080. */
  2081. location?: string;
  2082. /**
  2083. * If no location is provided you can provide here the raw html of this template.
  2084. * See http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
  2085. */
  2086. html?: string;
  2087. id?: string;
  2088. /**
  2089. * Parameters that will be delivered to the template and will render it accordingly.
  2090. */
  2091. params?: {
  2092. [key: string]: string | number | boolean | object;
  2093. };
  2094. /**
  2095. * Events to attach to this template.
  2096. * event name is the key. the value can either be a boolean (attach to the parent element)
  2097. * or a map of html id elements.
  2098. *
  2099. * See - http://doc.babylonjs.com/extensions/the_templating_system#event-binding
  2100. */
  2101. events?: {
  2102. pointerdown?: boolean | {
  2103. [id: string]: boolean;
  2104. };
  2105. pointerup?: boolean | {
  2106. [id: string]: boolean;
  2107. };
  2108. pointermove?: boolean | {
  2109. [id: string]: boolean;
  2110. };
  2111. pointerover?: boolean | {
  2112. [id: string]: boolean;
  2113. };
  2114. pointerout?: boolean | {
  2115. [id: string]: boolean;
  2116. };
  2117. pointerenter?: boolean | {
  2118. [id: string]: boolean;
  2119. };
  2120. pointerleave?: boolean | {
  2121. [id: string]: boolean;
  2122. };
  2123. pointercancel?: boolean | {
  2124. [id: string]: boolean;
  2125. };
  2126. click?: boolean | {
  2127. [id: string]: boolean;
  2128. };
  2129. dragstart?: boolean | {
  2130. [id: string]: boolean;
  2131. };
  2132. drop?: boolean | {
  2133. [id: string]: boolean;
  2134. };
  2135. [key: string]: boolean | {
  2136. [id: string]: boolean;
  2137. } | undefined;
  2138. };
  2139. }
  2140. }
  2141. declare module BabylonViewer {
  2142. export interface IVRConfiguration {
  2143. disabled?: boolean;
  2144. objectScaleFactor?: number;
  2145. disableInteractions?: boolean;
  2146. disableTeleportation?: boolean;
  2147. overrideFloorMeshName?: string;
  2148. vrOptions?: BABYLON.VRExperienceHelperOptions;
  2149. modelHeightCorrection?: number | boolean;
  2150. rotateUsingControllers?: boolean;
  2151. cameraPosition?: {
  2152. x: number;
  2153. y: number;
  2154. z: number;
  2155. };
  2156. }
  2157. }
  2158. declare module BabylonViewer {
  2159. /**
  2160. * Spherical polynomial coefficients (counter part to spherical harmonic coefficients used in shader irradiance calculation)
  2161. * @ignoreChildren
  2162. */
  2163. export interface SphericalPolynomalCoefficients {
  2164. x: BABYLON.Vector3;
  2165. y: BABYLON.Vector3;
  2166. z: BABYLON.Vector3;
  2167. xx: BABYLON.Vector3;
  2168. yy: BABYLON.Vector3;
  2169. zz: BABYLON.Vector3;
  2170. yz: BABYLON.Vector3;
  2171. zx: BABYLON.Vector3;
  2172. xy: BABYLON.Vector3;
  2173. }
  2174. /**
  2175. * Wraps data and maps required for environments with physically based rendering
  2176. */
  2177. export interface PBREnvironment {
  2178. /**
  2179. * Spherical Polynomial Coefficients representing an irradiance map
  2180. */
  2181. irradiancePolynomialCoefficients: SphericalPolynomalCoefficients;
  2182. /**
  2183. * Specular cubemap
  2184. */
  2185. specularTexture?: TextureCube;
  2186. /**
  2187. * A scale factor applied to RGB values after reading from environment maps
  2188. */
  2189. textureIntensityScale: number;
  2190. }
  2191. /**
  2192. * Environment map representations: layouts, projections and approximations
  2193. */
  2194. export type MapType = 'irradiance_sh_coefficients_9' | 'cubemap_faces';
  2195. /**
  2196. * Image type used for environment map
  2197. */
  2198. export type ImageType = 'png';
  2199. /**
  2200. * A generic field in JSON that report's its type
  2201. */
  2202. export interface TypedObject<T> {
  2203. type: T;
  2204. }
  2205. /**
  2206. * Describes a range of bytes starting at byte pos (inclusive) and finishing at byte pos + length - 1
  2207. */
  2208. export interface ByteRange {
  2209. pos: number;
  2210. length: number;
  2211. }
  2212. /**
  2213. * Complete Spectre Environment JSON Descriptor
  2214. */
  2215. export interface EnvJsonDescriptor {
  2216. radiance: TypedObject<MapType>;
  2217. irradiance: TypedObject<MapType>;
  2218. specular: TypedObject<MapType>;
  2219. }
  2220. /**
  2221. * Spherical harmonic coefficients to provide an irradiance map
  2222. */
  2223. export interface IrradianceSHCoefficients9 extends TypedObject<MapType> {
  2224. l00: Array<number>;
  2225. l1_1: Array<number>;
  2226. l10: Array<number>;
  2227. l11: Array<number>;
  2228. l2_2: Array<number>;
  2229. l2_1: Array<number>;
  2230. l20: Array<number>;
  2231. l21: Array<number>;
  2232. l22: Array<number>;
  2233. }
  2234. /**
  2235. * A generic set of images, where the image content is specified by byte ranges in the mipmaps field
  2236. */
  2237. export interface ImageSet<T> extends TypedObject<MapType> {
  2238. imageType: ImageType;
  2239. width: number;
  2240. height: number;
  2241. mipmaps: Array<T>;
  2242. multiplier: number;
  2243. }
  2244. /**
  2245. * A set of cubemap faces
  2246. */
  2247. export type CubemapFaces = ImageSet<Array<ByteRange>>;
  2248. /**
  2249. * A single image containing an atlas of equirectangular-projection maps across all mip levels
  2250. */
  2251. export type EquirectangularMipmapAtlas = ImageSet<ByteRange>;
  2252. /**
  2253. * A static class proving methods to aid parsing Spectre environment files
  2254. */
  2255. export class EnvironmentDeserializer {
  2256. /**
  2257. * Parses an arraybuffer into a new PBREnvironment object
  2258. * @param arrayBuffer The arraybuffer of the Spectre environment file
  2259. * @return a PBREnvironment object
  2260. */
  2261. static Parse(arrayBuffer: ArrayBuffer): PBREnvironment;
  2262. }
  2263. }
  2264. declare module BabylonViewer {
  2265. /**
  2266. * WebGL Pixel Formats
  2267. */
  2268. export const enum PixelFormat {
  2269. DEPTH_COMPONENT = 6402,
  2270. ALPHA = 6406,
  2271. RGB = 6407,
  2272. RGBA = 6408,
  2273. LUMINANCE = 6409,
  2274. LUMINANCE_ALPHA = 6410,
  2275. }
  2276. /**
  2277. * WebGL Pixel Types
  2278. */
  2279. export const enum PixelType {
  2280. UNSIGNED_BYTE = 5121,
  2281. UNSIGNED_SHORT_4_4_4_4 = 32819,
  2282. UNSIGNED_SHORT_5_5_5_1 = 32820,
  2283. UNSIGNED_SHORT_5_6_5 = 33635,
  2284. }
  2285. /**
  2286. * WebGL Texture Magnification Filter
  2287. */
  2288. export const enum TextureMagFilter {
  2289. NEAREST = 9728,
  2290. LINEAR = 9729,
  2291. }
  2292. /**
  2293. * WebGL Texture Minification Filter
  2294. */
  2295. export const enum TextureMinFilter {
  2296. NEAREST = 9728,
  2297. LINEAR = 9729,
  2298. NEAREST_MIPMAP_NEAREST = 9984,
  2299. LINEAR_MIPMAP_NEAREST = 9985,
  2300. NEAREST_MIPMAP_LINEAR = 9986,
  2301. LINEAR_MIPMAP_LINEAR = 9987,
  2302. }
  2303. /**
  2304. * WebGL Texture Wrap Modes
  2305. */
  2306. export const enum TextureWrapMode {
  2307. REPEAT = 10497,
  2308. CLAMP_TO_EDGE = 33071,
  2309. MIRRORED_REPEAT = 33648,
  2310. }
  2311. /**
  2312. * Raw texture data and descriptor sufficient for WebGL texture upload
  2313. */
  2314. export interface TextureData {
  2315. /**
  2316. * Width of image
  2317. */
  2318. width: number;
  2319. /**
  2320. * Height of image
  2321. */
  2322. height: number;
  2323. /**
  2324. * Format of pixels in data
  2325. */
  2326. format: PixelFormat;
  2327. /**
  2328. * Row byte alignment of pixels in data
  2329. */
  2330. alignment: number;
  2331. /**
  2332. * Pixel data
  2333. */
  2334. data: ArrayBufferView;
  2335. }
  2336. /**
  2337. * Wraps sampling parameters for a WebGL texture
  2338. */
  2339. export interface SamplingParameters {
  2340. /**
  2341. * Magnification mode when upsampling from a WebGL texture
  2342. */
  2343. magFilter?: TextureMagFilter;
  2344. /**
  2345. * Minification mode when upsampling from a WebGL texture
  2346. */
  2347. minFilter?: TextureMinFilter;
  2348. /**
  2349. * X axis wrapping mode when sampling out of a WebGL texture bounds
  2350. */
  2351. wrapS?: TextureWrapMode;
  2352. /**
  2353. * Y axis wrapping mode when sampling out of a WebGL texture bounds
  2354. */
  2355. wrapT?: TextureWrapMode;
  2356. /**
  2357. * Anisotropic filtering samples
  2358. */
  2359. maxAnisotropy?: number;
  2360. }
  2361. /**
  2362. * Represents a valid WebGL texture source for use in texImage2D
  2363. */
  2364. export type TextureSource = TextureData | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
  2365. /**
  2366. * A generic set of texture mipmaps (where index 0 has the largest dimension)
  2367. */
  2368. export type Mipmaps<T> = Array<T>;
  2369. /**
  2370. * A set of 6 cubemap arranged in the order [+x, -x, +y, -y, +z, -z]
  2371. */
  2372. export type Faces<T> = Array<T>;
  2373. /**
  2374. * A set of texture mipmaps specifically for 2D textures in WebGL (where index 0 has the largest dimension)
  2375. */
  2376. export type Mipmaps2D = Mipmaps<TextureSource>;
  2377. /**
  2378. * A set of texture mipmaps specifically for cubemap textures in WebGL (where index 0 has the largest dimension)
  2379. */
  2380. export type MipmapsCube = Mipmaps<Faces<TextureSource>>;
  2381. /**
  2382. * A minimal WebGL cubemap descriptor
  2383. */
  2384. export class TextureCube {
  2385. internalFormat: PixelFormat;
  2386. type: PixelType;
  2387. source: MipmapsCube;
  2388. /**
  2389. * Returns the width of a face of the texture or 0 if not available
  2390. */
  2391. readonly Width: number;
  2392. /**
  2393. * Returns the height of a face of the texture or 0 if not available
  2394. */
  2395. readonly Height: number;
  2396. /**
  2397. * constructor
  2398. * @param internalFormat WebGL pixel format for the texture on the GPU
  2399. * @param type WebGL pixel type of the supplied data and texture on the GPU
  2400. * @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
  2401. */
  2402. constructor(internalFormat: PixelFormat, type: PixelType, source?: MipmapsCube);
  2403. }
  2404. /**
  2405. * A static class providing methods to aid working with Bablyon textures.
  2406. */
  2407. export class TextureUtils {
  2408. /**
  2409. * A prefix used when storing a babylon texture object reference on a Spectre texture object
  2410. */
  2411. static BabylonTextureKeyPrefix: string;
  2412. /**
  2413. * Controls anisotropic filtering for deserialized textures.
  2414. */
  2415. static MaxAnisotropy: number;
  2416. /**
  2417. * Returns a BabylonCubeTexture instance from a Spectre texture cube, subject to sampling parameters.
  2418. * If such a texture has already been requested in the past, this texture will be returned, otherwise a new one will be created.
  2419. * The advantage of this is to enable working with texture objects without the need to initialize on the GPU until desired.
  2420. * @param scene A Babylon BABYLON.Scene instance
  2421. * @param textureCube A Spectre TextureCube object
  2422. * @param parameters WebGL texture sampling parameters
  2423. * @param automaticMipmaps Pass true to enable automatic mipmap generation where possible (requires power of images)
  2424. * @param environment Specifies that the texture will be used as an environment
  2425. * @param singleLod Specifies that the texture will be a singleLod (for environment)
  2426. * @return Babylon cube texture
  2427. */
  2428. static GetBabylonCubeTexture(scene: BABYLON.Scene, textureCube: TextureCube, automaticMipmaps: boolean, environment?: boolean, singleLod?: boolean): BABYLON.CubeTexture;
  2429. /**
  2430. * Applies Spectre SamplingParameters to a Babylon texture by directly setting texture parameters on the internal WebGLTexture as well as setting Babylon fields
  2431. * @param babylonTexture Babylon texture to apply texture to (requires the Babylon texture has an initialize _texture field)
  2432. * @param parameters Spectre SamplingParameters to apply
  2433. */
  2434. static ApplySamplingParameters(babylonTexture: BABYLON.BaseTexture, parameters: SamplingParameters): void;
  2435. /**
  2436. * Environment preprocessing dedicated value (Internal Use or Advanced only).
  2437. */
  2438. static EnvironmentLODScale: number;
  2439. /**
  2440. * Environment preprocessing dedicated value (Internal Use or Advanced only)..
  2441. */
  2442. static EnvironmentLODOffset: number;
  2443. }
  2444. }