babylon.viewer.d.ts 103 KB

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