babylon.viewer.d.ts 103 KB

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