babylonjs.loaders.module.d.ts 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115
  1. /// <reference types="babylonjs"/>
  2. /// <reference types="babylonjs-gltf2interface"/>
  3. declare module 'babylonjs-loaders' {
  4. export = BABYLON;
  5. }
  6. declare module BABYLON {
  7. class STLFileLoader implements ISceneLoaderPlugin {
  8. solidPattern: RegExp;
  9. facetsPattern: RegExp;
  10. normalPattern: RegExp;
  11. vertexPattern: RegExp;
  12. name: string;
  13. extensions: ISceneLoaderPluginExtensions;
  14. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  15. load(scene: Scene, data: any, rootUrl: string): boolean;
  16. loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
  17. private isBinary(data);
  18. private parseBinary(mesh, data);
  19. private parseASCII(mesh, solidData);
  20. }
  21. }
  22. declare module BABYLON {
  23. /**
  24. * Class reading and parsing the MTL file bundled with the obj file.
  25. */
  26. class MTLFileLoader {
  27. materials: BABYLON.StandardMaterial[];
  28. /**
  29. * This function will read the mtl file and create each material described inside
  30. * This function could be improve by adding :
  31. * -some component missing (Ni, Tf...)
  32. * -including the specific options available
  33. *
  34. * @param scene
  35. * @param data
  36. * @param rootUrl
  37. */
  38. parseMTL(scene: BABYLON.Scene, data: string, rootUrl: string): void;
  39. /**
  40. * Gets the texture for the material.
  41. *
  42. * If the material is imported from input file,
  43. * We sanitize the url to ensure it takes the textre from aside the material.
  44. *
  45. * @param rootUrl The root url to load from
  46. * @param value The value stored in the mtl
  47. * @return The Texture
  48. */
  49. private static _getTexture(rootUrl, value, scene);
  50. }
  51. class OBJFileLoader implements ISceneLoaderPlugin {
  52. static OPTIMIZE_WITH_UV: boolean;
  53. name: string;
  54. extensions: string;
  55. obj: RegExp;
  56. group: RegExp;
  57. mtllib: RegExp;
  58. usemtl: RegExp;
  59. smooth: RegExp;
  60. vertexPattern: RegExp;
  61. normalPattern: RegExp;
  62. uvPattern: RegExp;
  63. facePattern1: RegExp;
  64. facePattern2: RegExp;
  65. facePattern3: RegExp;
  66. facePattern4: RegExp;
  67. /**
  68. * Calls synchronously the MTL file attached to this obj.
  69. * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
  70. * Without this function materials are not displayed in the first frame (but displayed after).
  71. * In consequence it is impossible to get material information in your HTML file
  72. *
  73. * @param url The URL of the MTL file
  74. * @param rootUrl
  75. * @param onSuccess Callback function to be called when the MTL file is loaded
  76. * @private
  77. */
  78. private _loadMTL(url, rootUrl, onSuccess);
  79. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  80. load(scene: Scene, data: string, rootUrl: string): boolean;
  81. loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
  82. /**
  83. * Read the OBJ file and create an Array of meshes.
  84. * Each mesh contains all information given by the OBJ and the MTL file.
  85. * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
  86. *
  87. * @param meshesNames
  88. * @param scene BABYLON.Scene The scene where are displayed the data
  89. * @param data String The content of the obj file
  90. * @param rootUrl String The path to the folder
  91. * @returns Array<AbstractMesh>
  92. * @private
  93. */
  94. private _parseSolid(meshesNames, scene, data, rootUrl);
  95. }
  96. }
  97. declare module BABYLON {
  98. enum GLTFLoaderCoordinateSystemMode {
  99. /**
  100. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  101. */
  102. AUTO = 0,
  103. /**
  104. * Sets the useRightHandedSystem flag on the scene.
  105. */
  106. FORCE_RIGHT_HANDED = 1,
  107. }
  108. enum GLTFLoaderAnimationStartMode {
  109. /**
  110. * No animation will start.
  111. */
  112. NONE = 0,
  113. /**
  114. * The first animation will start.
  115. */
  116. FIRST = 1,
  117. /**
  118. * All animations will start.
  119. */
  120. ALL = 2,
  121. }
  122. interface IGLTFLoaderData {
  123. json: Object;
  124. bin: Nullable<ArrayBufferView>;
  125. }
  126. interface IGLTFLoaderExtension {
  127. /**
  128. * The name of this extension.
  129. */
  130. readonly name: string;
  131. /**
  132. * Whether this extension is enabled.
  133. */
  134. enabled: boolean;
  135. }
  136. enum GLTFLoaderState {
  137. Loading = 0,
  138. Ready = 1,
  139. Complete = 2,
  140. }
  141. interface IGLTFLoader extends IDisposable {
  142. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  143. animationStartMode: GLTFLoaderAnimationStartMode;
  144. compileMaterials: boolean;
  145. useClipPlane: boolean;
  146. compileShadowGenerators: boolean;
  147. onMeshLoadedObservable: Observable<AbstractMesh>;
  148. onTextureLoadedObservable: Observable<BaseTexture>;
  149. onMaterialLoadedObservable: Observable<Material>;
  150. onAnimationGroupLoadedObservable: Observable<AnimationGroup>;
  151. onCompleteObservable: Observable<IGLTFLoader>;
  152. onDisposeObservable: Observable<IGLTFLoader>;
  153. onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  154. state: Nullable<GLTFLoaderState>;
  155. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{
  156. meshes: AbstractMesh[];
  157. particleSystems: ParticleSystem[];
  158. skeletons: Skeleton[];
  159. }>;
  160. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>;
  161. }
  162. class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  163. static CreateGLTFLoaderV1: () => IGLTFLoader;
  164. static CreateGLTFLoaderV2: () => IGLTFLoader;
  165. /**
  166. * Raised when the asset has been parsed.
  167. * The data.json property stores the glTF JSON.
  168. * The data.bin property stores the BIN chunk from a glTF binary or null if the input is not a glTF binary.
  169. */
  170. onParsedObservable: Observable<IGLTFLoaderData>;
  171. private _onParsedObserver;
  172. onParsed: (loaderData: IGLTFLoaderData) => void;
  173. static IncrementalLoading: boolean;
  174. static HomogeneousCoordinates: boolean;
  175. /**
  176. * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
  177. */
  178. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  179. /**
  180. * The animation start mode (NONE, FIRST, ALL).
  181. */
  182. animationStartMode: GLTFLoaderAnimationStartMode;
  183. /**
  184. * Set to true to compile materials before raising the success callback.
  185. */
  186. compileMaterials: boolean;
  187. /**
  188. * Set to true to also compile materials with clip planes.
  189. */
  190. useClipPlane: boolean;
  191. /**
  192. * Set to true to compile shadow generators before raising the success callback.
  193. */
  194. compileShadowGenerators: boolean;
  195. /**
  196. * Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  197. */
  198. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  199. private _onMeshLoadedObserver;
  200. onMeshLoaded: (mesh: AbstractMesh) => void;
  201. /**
  202. * Raised when the loader creates a texture after parsing the glTF properties of the texture.
  203. */
  204. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  205. private _onTextureLoadedObserver;
  206. onTextureLoaded: (texture: BaseTexture) => void;
  207. /**
  208. * Raised when the loader creates a material after parsing the glTF properties of the material.
  209. */
  210. readonly onMaterialLoadedObservable: Observable<Material>;
  211. private _onMaterialLoadedObserver;
  212. onMaterialLoaded: (material: Material) => void;
  213. /**
  214. * Raised when the loader creates an animation group after parsing the glTF properties of the material.
  215. */
  216. readonly onAnimationGroupLoadedObservable: Observable<AnimationGroup>;
  217. private _onAnimationGroupLoadedObserver;
  218. onAnimationGroupLoaded: (animationGroup: AnimationGroup) => void;
  219. /**
  220. * Raised when the asset is completely loaded, immediately before the loader is disposed.
  221. * For assets with LODs, raised when all of the LODs are complete.
  222. * For assets without LODs, raised when the model is complete, immediately after onSuccess.
  223. */
  224. readonly onCompleteObservable: Observable<GLTFFileLoader>;
  225. private _onCompleteObserver;
  226. onComplete: () => void;
  227. /**
  228. * Raised when the loader is disposed.
  229. */
  230. readonly onDisposeObservable: Observable<GLTFFileLoader>;
  231. private _onDisposeObserver;
  232. onDispose: () => void;
  233. /**
  234. * Raised after a loader extension is created.
  235. * Set additional options for a loader extension in this event.
  236. */
  237. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  238. private _onExtensionLoadedObserver;
  239. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  240. /**
  241. * Gets a promise that resolves when the asset to be completely loaded.
  242. * @returns A promise that resolves when the asset is completely loaded.
  243. */
  244. whenCompleteAsync(): Promise<void>;
  245. /**
  246. * The loader state or null if not active.
  247. */
  248. readonly loaderState: Nullable<GLTFLoaderState>;
  249. private _loader;
  250. name: string;
  251. extensions: ISceneLoaderPluginExtensions;
  252. /**
  253. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  254. */
  255. dispose(): void;
  256. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  257. meshes: AbstractMesh[];
  258. particleSystems: ParticleSystem[];
  259. skeletons: Skeleton[];
  260. }>;
  261. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  262. loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>;
  263. canDirectLoad(data: string): boolean;
  264. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  265. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  266. private _parse(data);
  267. private _getLoader(loaderData);
  268. private static _parseBinary(data);
  269. private static _parseV1(binaryReader);
  270. private static _parseV2(binaryReader);
  271. private static _parseVersion(version);
  272. private static _compareVersion(a, b);
  273. private static _decodeBufferToText(buffer);
  274. }
  275. }
  276. declare module BABYLON.GLTF1 {
  277. /**
  278. * Enums
  279. */
  280. enum EComponentType {
  281. BYTE = 5120,
  282. UNSIGNED_BYTE = 5121,
  283. SHORT = 5122,
  284. UNSIGNED_SHORT = 5123,
  285. FLOAT = 5126,
  286. }
  287. enum EShaderType {
  288. FRAGMENT = 35632,
  289. VERTEX = 35633,
  290. }
  291. enum EParameterType {
  292. BYTE = 5120,
  293. UNSIGNED_BYTE = 5121,
  294. SHORT = 5122,
  295. UNSIGNED_SHORT = 5123,
  296. INT = 5124,
  297. UNSIGNED_INT = 5125,
  298. FLOAT = 5126,
  299. FLOAT_VEC2 = 35664,
  300. FLOAT_VEC3 = 35665,
  301. FLOAT_VEC4 = 35666,
  302. INT_VEC2 = 35667,
  303. INT_VEC3 = 35668,
  304. INT_VEC4 = 35669,
  305. BOOL = 35670,
  306. BOOL_VEC2 = 35671,
  307. BOOL_VEC3 = 35672,
  308. BOOL_VEC4 = 35673,
  309. FLOAT_MAT2 = 35674,
  310. FLOAT_MAT3 = 35675,
  311. FLOAT_MAT4 = 35676,
  312. SAMPLER_2D = 35678,
  313. }
  314. enum ETextureWrapMode {
  315. CLAMP_TO_EDGE = 33071,
  316. MIRRORED_REPEAT = 33648,
  317. REPEAT = 10497,
  318. }
  319. enum ETextureFilterType {
  320. NEAREST = 9728,
  321. LINEAR = 9728,
  322. NEAREST_MIPMAP_NEAREST = 9984,
  323. LINEAR_MIPMAP_NEAREST = 9985,
  324. NEAREST_MIPMAP_LINEAR = 9986,
  325. LINEAR_MIPMAP_LINEAR = 9987,
  326. }
  327. enum ETextureFormat {
  328. ALPHA = 6406,
  329. RGB = 6407,
  330. RGBA = 6408,
  331. LUMINANCE = 6409,
  332. LUMINANCE_ALPHA = 6410,
  333. }
  334. enum ECullingType {
  335. FRONT = 1028,
  336. BACK = 1029,
  337. FRONT_AND_BACK = 1032,
  338. }
  339. enum EBlendingFunction {
  340. ZERO = 0,
  341. ONE = 1,
  342. SRC_COLOR = 768,
  343. ONE_MINUS_SRC_COLOR = 769,
  344. DST_COLOR = 774,
  345. ONE_MINUS_DST_COLOR = 775,
  346. SRC_ALPHA = 770,
  347. ONE_MINUS_SRC_ALPHA = 771,
  348. DST_ALPHA = 772,
  349. ONE_MINUS_DST_ALPHA = 773,
  350. CONSTANT_COLOR = 32769,
  351. ONE_MINUS_CONSTANT_COLOR = 32770,
  352. CONSTANT_ALPHA = 32771,
  353. ONE_MINUS_CONSTANT_ALPHA = 32772,
  354. SRC_ALPHA_SATURATE = 776,
  355. }
  356. /**
  357. * Interfaces
  358. */
  359. interface IGLTFProperty {
  360. extensions?: {
  361. [key: string]: any;
  362. };
  363. extras?: Object;
  364. }
  365. interface IGLTFChildRootProperty extends IGLTFProperty {
  366. name?: string;
  367. }
  368. interface IGLTFAccessor extends IGLTFChildRootProperty {
  369. bufferView: string;
  370. byteOffset: number;
  371. byteStride: number;
  372. count: number;
  373. type: string;
  374. componentType: EComponentType;
  375. max?: number[];
  376. min?: number[];
  377. name?: string;
  378. }
  379. interface IGLTFBufferView extends IGLTFChildRootProperty {
  380. buffer: string;
  381. byteOffset: number;
  382. byteLength: number;
  383. byteStride: number;
  384. target?: number;
  385. }
  386. interface IGLTFBuffer extends IGLTFChildRootProperty {
  387. uri: string;
  388. byteLength?: number;
  389. type?: string;
  390. }
  391. interface IGLTFShader extends IGLTFChildRootProperty {
  392. uri: string;
  393. type: EShaderType;
  394. }
  395. interface IGLTFProgram extends IGLTFChildRootProperty {
  396. attributes: string[];
  397. fragmentShader: string;
  398. vertexShader: string;
  399. }
  400. interface IGLTFTechniqueParameter {
  401. type: number;
  402. count?: number;
  403. semantic?: string;
  404. node?: string;
  405. value?: number | boolean | string | Array<any>;
  406. source?: string;
  407. babylonValue?: any;
  408. }
  409. interface IGLTFTechniqueCommonProfile {
  410. lightingModel: string;
  411. texcoordBindings: Object;
  412. parameters?: Array<any>;
  413. }
  414. interface IGLTFTechniqueStatesFunctions {
  415. blendColor?: number[];
  416. blendEquationSeparate?: number[];
  417. blendFuncSeparate?: number[];
  418. colorMask: boolean[];
  419. cullFace: number[];
  420. }
  421. interface IGLTFTechniqueStates {
  422. enable: number[];
  423. functions: IGLTFTechniqueStatesFunctions;
  424. }
  425. interface IGLTFTechnique extends IGLTFChildRootProperty {
  426. parameters: {
  427. [key: string]: IGLTFTechniqueParameter;
  428. };
  429. program: string;
  430. attributes: {
  431. [key: string]: string;
  432. };
  433. uniforms: {
  434. [key: string]: string;
  435. };
  436. states: IGLTFTechniqueStates;
  437. }
  438. interface IGLTFMaterial extends IGLTFChildRootProperty {
  439. technique?: string;
  440. values: string[];
  441. }
  442. interface IGLTFMeshPrimitive extends IGLTFProperty {
  443. attributes: {
  444. [key: string]: string;
  445. };
  446. indices: string;
  447. material: string;
  448. mode?: number;
  449. }
  450. interface IGLTFMesh extends IGLTFChildRootProperty {
  451. primitives: IGLTFMeshPrimitive[];
  452. }
  453. interface IGLTFImage extends IGLTFChildRootProperty {
  454. uri: string;
  455. }
  456. interface IGLTFSampler extends IGLTFChildRootProperty {
  457. magFilter?: number;
  458. minFilter?: number;
  459. wrapS?: number;
  460. wrapT?: number;
  461. }
  462. interface IGLTFTexture extends IGLTFChildRootProperty {
  463. sampler: string;
  464. source: string;
  465. format?: ETextureFormat;
  466. internalFormat?: ETextureFormat;
  467. target?: number;
  468. type?: number;
  469. babylonTexture?: Texture;
  470. }
  471. interface IGLTFAmbienLight {
  472. color?: number[];
  473. }
  474. interface IGLTFDirectionalLight {
  475. color?: number[];
  476. }
  477. interface IGLTFPointLight {
  478. color?: number[];
  479. constantAttenuation?: number;
  480. linearAttenuation?: number;
  481. quadraticAttenuation?: number;
  482. }
  483. interface IGLTFSpotLight {
  484. color?: number[];
  485. constantAttenuation?: number;
  486. fallOfAngle?: number;
  487. fallOffExponent?: number;
  488. linearAttenuation?: number;
  489. quadraticAttenuation?: number;
  490. }
  491. interface IGLTFLight extends IGLTFChildRootProperty {
  492. type: string;
  493. }
  494. interface IGLTFCameraOrthographic {
  495. xmag: number;
  496. ymag: number;
  497. zfar: number;
  498. znear: number;
  499. }
  500. interface IGLTFCameraPerspective {
  501. aspectRatio: number;
  502. yfov: number;
  503. zfar: number;
  504. znear: number;
  505. }
  506. interface IGLTFCamera extends IGLTFChildRootProperty {
  507. type: string;
  508. }
  509. interface IGLTFAnimationChannelTarget {
  510. id: string;
  511. path: string;
  512. }
  513. interface IGLTFAnimationChannel {
  514. sampler: string;
  515. target: IGLTFAnimationChannelTarget;
  516. }
  517. interface IGLTFAnimationSampler {
  518. input: string;
  519. output: string;
  520. interpolation?: string;
  521. }
  522. interface IGLTFAnimation extends IGLTFChildRootProperty {
  523. channels?: IGLTFAnimationChannel[];
  524. parameters?: {
  525. [key: string]: string;
  526. };
  527. samplers?: {
  528. [key: string]: IGLTFAnimationSampler;
  529. };
  530. }
  531. interface IGLTFNodeInstanceSkin {
  532. skeletons: string[];
  533. skin: string;
  534. meshes: string[];
  535. }
  536. interface IGLTFSkins extends IGLTFChildRootProperty {
  537. bindShapeMatrix: number[];
  538. inverseBindMatrices: string;
  539. jointNames: string[];
  540. babylonSkeleton?: Skeleton;
  541. }
  542. interface IGLTFNode extends IGLTFChildRootProperty {
  543. camera?: string;
  544. children: string[];
  545. skin?: string;
  546. jointName?: string;
  547. light?: string;
  548. matrix: number[];
  549. mesh?: string;
  550. meshes?: string[];
  551. rotation?: number[];
  552. scale?: number[];
  553. translation?: number[];
  554. babylonNode?: Node;
  555. }
  556. interface IGLTFScene extends IGLTFChildRootProperty {
  557. nodes: string[];
  558. }
  559. /**
  560. * Runtime
  561. */
  562. interface IGLTFRuntime {
  563. extensions: {
  564. [key: string]: any;
  565. };
  566. accessors: {
  567. [key: string]: IGLTFAccessor;
  568. };
  569. buffers: {
  570. [key: string]: IGLTFBuffer;
  571. };
  572. bufferViews: {
  573. [key: string]: IGLTFBufferView;
  574. };
  575. meshes: {
  576. [key: string]: IGLTFMesh;
  577. };
  578. lights: {
  579. [key: string]: IGLTFLight;
  580. };
  581. cameras: {
  582. [key: string]: IGLTFCamera;
  583. };
  584. nodes: {
  585. [key: string]: IGLTFNode;
  586. };
  587. images: {
  588. [key: string]: IGLTFImage;
  589. };
  590. textures: {
  591. [key: string]: IGLTFTexture;
  592. };
  593. shaders: {
  594. [key: string]: IGLTFShader;
  595. };
  596. programs: {
  597. [key: string]: IGLTFProgram;
  598. };
  599. samplers: {
  600. [key: string]: IGLTFSampler;
  601. };
  602. techniques: {
  603. [key: string]: IGLTFTechnique;
  604. };
  605. materials: {
  606. [key: string]: IGLTFMaterial;
  607. };
  608. animations: {
  609. [key: string]: IGLTFAnimation;
  610. };
  611. skins: {
  612. [key: string]: IGLTFSkins;
  613. };
  614. currentScene?: Object;
  615. scenes: {
  616. [key: string]: IGLTFScene;
  617. };
  618. extensionsUsed: string[];
  619. extensionsRequired?: string[];
  620. buffersCount: number;
  621. shaderscount: number;
  622. scene: Scene;
  623. rootUrl: string;
  624. loadedBufferCount: number;
  625. loadedBufferViews: {
  626. [name: string]: ArrayBufferView;
  627. };
  628. loadedShaderCount: number;
  629. importOnlyMeshes: boolean;
  630. importMeshesNames?: string[];
  631. dummyNodes: Node[];
  632. }
  633. /**
  634. * Bones
  635. */
  636. interface INodeToRoot {
  637. bone: Bone;
  638. node: IGLTFNode;
  639. id: string;
  640. }
  641. interface IJointNode {
  642. node: IGLTFNode;
  643. id: string;
  644. }
  645. }
  646. declare module BABYLON.GLTF1 {
  647. /**
  648. * Implementation of the base glTF spec
  649. */
  650. class GLTFLoaderBase {
  651. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  652. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  653. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  654. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  655. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): void;
  656. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  657. }
  658. /**
  659. * glTF V1 Loader
  660. */
  661. class GLTFLoader implements IGLTFLoader {
  662. static Extensions: {
  663. [name: string]: GLTFLoaderExtension;
  664. };
  665. static RegisterExtension(extension: GLTFLoaderExtension): void;
  666. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  667. animationStartMode: GLTFLoaderAnimationStartMode;
  668. compileMaterials: boolean;
  669. useClipPlane: boolean;
  670. compileShadowGenerators: boolean;
  671. onDisposeObservable: Observable<IGLTFLoader>;
  672. onMeshLoadedObservable: Observable<AbstractMesh>;
  673. onTextureLoadedObservable: Observable<BaseTexture>;
  674. onMaterialLoadedObservable: Observable<Material>;
  675. onAnimationGroupLoadedObservable: Observable<AnimationGroup>;
  676. onCompleteObservable: Observable<IGLTFLoader>;
  677. onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  678. state: Nullable<GLTFLoaderState>;
  679. dispose(): void;
  680. private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress, onError);
  681. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<{
  682. meshes: AbstractMesh[];
  683. particleSystems: ParticleSystem[];
  684. skeletons: Skeleton[];
  685. }>;
  686. private _loadAsync(scene, data, rootUrl, onSuccess, onProgress, onError);
  687. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  688. private _loadShadersAsync(gltfRuntime, onload);
  689. private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?);
  690. private _createNodes(gltfRuntime);
  691. }
  692. }
  693. declare module BABYLON.GLTF1 {
  694. /**
  695. * Utils functions for GLTF
  696. */
  697. class GLTFUtils {
  698. /**
  699. * Sets the given "parameter" matrix
  700. * @param scene: the {BABYLON.Scene} object
  701. * @param source: the source node where to pick the matrix
  702. * @param parameter: the GLTF technique parameter
  703. * @param uniformName: the name of the shader's uniform
  704. * @param shaderMaterial: the shader material
  705. */
  706. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  707. /**
  708. * Sets the given "parameter" matrix
  709. * @param shaderMaterial: the shader material
  710. * @param uniform: the name of the shader's uniform
  711. * @param value: the value of the uniform
  712. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  713. */
  714. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  715. /**
  716. * Returns the wrap mode of the texture
  717. * @param mode: the mode value
  718. */
  719. static GetWrapMode(mode: number): number;
  720. /**
  721. * Returns the byte stride giving an accessor
  722. * @param accessor: the GLTF accessor objet
  723. */
  724. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  725. /**
  726. * Returns the texture filter mode giving a mode value
  727. * @param mode: the filter mode value
  728. */
  729. static GetTextureFilterMode(mode: number): ETextureFilterType;
  730. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  731. /**
  732. * Returns a buffer from its accessor
  733. * @param gltfRuntime: the GLTF runtime
  734. * @param accessor: the GLTF accessor
  735. */
  736. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  737. /**
  738. * Decodes a buffer view into a string
  739. * @param view: the buffer view
  740. */
  741. static DecodeBufferToText(view: ArrayBufferView): string;
  742. /**
  743. * Returns the default material of gltf. Related to
  744. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  745. * @param scene: the Babylon.js scene
  746. */
  747. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  748. private static _DefaultMaterial;
  749. }
  750. }
  751. declare module BABYLON.GLTF1 {
  752. abstract class GLTFLoaderExtension {
  753. private _name;
  754. constructor(name: string);
  755. readonly name: string;
  756. /**
  757. * Defines an override for loading the runtime
  758. * Return true to stop further extensions from loading the runtime
  759. */
  760. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  761. /**
  762. * Defines an onverride for creating gltf runtime
  763. * Return true to stop further extensions from creating the runtime
  764. */
  765. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  766. /**
  767. * Defines an override for loading buffers
  768. * Return true to stop further extensions from loading this buffer
  769. */
  770. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  771. /**
  772. * Defines an override for loading texture buffers
  773. * Return true to stop further extensions from loading this texture data
  774. */
  775. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  776. /**
  777. * Defines an override for creating textures
  778. * Return true to stop further extensions from loading this texture
  779. */
  780. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  781. /**
  782. * Defines an override for loading shader strings
  783. * Return true to stop further extensions from loading this shader data
  784. */
  785. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  786. /**
  787. * Defines an override for loading materials
  788. * Return true to stop further extensions from loading this material
  789. */
  790. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  791. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): void;
  792. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): void;
  793. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  794. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  795. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string) => void, onError: (message: string) => void): void;
  796. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  797. private static LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);
  798. private static CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
  799. private static ApplyExtensions(func, defaultFunc);
  800. }
  801. }
  802. declare module BABYLON.GLTF1 {
  803. class GLTFBinaryExtension extends GLTFLoaderExtension {
  804. private _bin;
  805. constructor();
  806. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  807. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  808. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  809. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  810. }
  811. }
  812. declare module BABYLON.GLTF1 {
  813. class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  814. constructor();
  815. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  816. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  817. private _loadTexture(gltfRuntime, id, material, propertyPath, onError);
  818. }
  819. }
  820. declare module BABYLON.GLTF2 {
  821. interface TypedArray extends ArrayBufferView {
  822. [index: number]: number;
  823. }
  824. interface IArrayItem {
  825. _index: number;
  826. }
  827. class ArrayItem {
  828. static Assign(values?: IArrayItem[]): void;
  829. }
  830. }
  831. declare module BABYLON.GLTF2 {
  832. interface ILoaderAccessor extends IAccessor, IArrayItem {
  833. _data?: Promise<TypedArray>;
  834. }
  835. interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
  836. _babylonAnimationGroup: AnimationGroup;
  837. }
  838. interface ILoaderAnimationSamplerData {
  839. input: Float32Array;
  840. interpolation: AnimationSamplerInterpolation;
  841. output: Float32Array;
  842. }
  843. interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
  844. _data: Promise<ILoaderAnimationSamplerData>;
  845. }
  846. interface ILoaderAnimation extends IAnimation, IArrayItem {
  847. channels: ILoaderAnimationChannel[];
  848. samplers: ILoaderAnimationSampler[];
  849. _babylonAnimationGroup: Nullable<AnimationGroup>;
  850. }
  851. interface ILoaderBuffer extends IBuffer, IArrayItem {
  852. _data?: Promise<ArrayBufferView>;
  853. }
  854. interface ILoaderBufferView extends IBufferView, IArrayItem {
  855. _data?: Promise<ArrayBufferView>;
  856. }
  857. interface ILoaderCamera extends ICamera, IArrayItem {
  858. }
  859. interface ILoaderImage extends IImage, IArrayItem {
  860. _objectURL?: Promise<string>;
  861. }
  862. interface ILoaderMaterial extends IMaterial, IArrayItem {
  863. _babylonMaterial?: Material;
  864. _babylonMeshes?: AbstractMesh[];
  865. _loaded?: Promise<void>;
  866. }
  867. interface ILoaderMesh extends IMesh, IArrayItem {
  868. primitives: ILoaderMeshPrimitive[];
  869. }
  870. interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
  871. }
  872. interface ILoaderNode extends INode, IArrayItem {
  873. _parent: ILoaderNode;
  874. _babylonMesh?: Mesh;
  875. _primitiveBabylonMeshes?: Mesh[];
  876. _babylonAnimationTargets?: Node[];
  877. _numMorphTargets?: number;
  878. }
  879. interface ILoaderSamplerData {
  880. noMipMaps: boolean;
  881. samplingMode: number;
  882. wrapU: number;
  883. wrapV: number;
  884. }
  885. interface ILoaderSampler extends ISampler, IArrayItem {
  886. _data?: ILoaderSamplerData;
  887. }
  888. interface ILoaderScene extends IScene, IArrayItem {
  889. }
  890. interface ILoaderSkin extends ISkin, IArrayItem {
  891. _babylonSkeleton: Nullable<Skeleton>;
  892. _loaded?: Promise<void>;
  893. }
  894. interface ILoaderTexture extends ITexture, IArrayItem {
  895. }
  896. interface ILoaderGLTF extends IGLTF {
  897. accessors?: ILoaderAccessor[];
  898. animations?: ILoaderAnimation[];
  899. buffers?: ILoaderBuffer[];
  900. bufferViews?: ILoaderBufferView[];
  901. cameras?: ILoaderCamera[];
  902. images?: ILoaderImage[];
  903. materials?: ILoaderMaterial[];
  904. meshes?: ILoaderMesh[];
  905. nodes?: ILoaderNode[];
  906. samplers?: ILoaderSampler[];
  907. scenes?: ILoaderScene[];
  908. skins?: ILoaderSkin[];
  909. textures?: ILoaderTexture[];
  910. }
  911. }
  912. declare module BABYLON.GLTF2 {
  913. class GLTFLoader implements IGLTFLoader {
  914. _gltf: ILoaderGLTF;
  915. _babylonScene: Scene;
  916. _completePromises: Promise<void>[];
  917. private _disposed;
  918. private _state;
  919. private _extensions;
  920. private _rootUrl;
  921. private _rootBabylonMesh;
  922. private _defaultSampler;
  923. private _progressCallback?;
  924. private _requests;
  925. private static _Names;
  926. private static _Factories;
  927. static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
  928. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  929. animationStartMode: GLTFLoaderAnimationStartMode;
  930. compileMaterials: boolean;
  931. useClipPlane: boolean;
  932. compileShadowGenerators: boolean;
  933. readonly onDisposeObservable: Observable<IGLTFLoader>;
  934. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  935. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  936. readonly onMaterialLoadedObservable: Observable<Material>;
  937. readonly onAnimationGroupLoadedObservable: Observable<AnimationGroup>;
  938. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  939. readonly onCompleteObservable: Observable<IGLTFLoader>;
  940. readonly state: Nullable<GLTFLoaderState>;
  941. dispose(): void;
  942. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  943. meshes: AbstractMesh[];
  944. particleSystems: ParticleSystem[];
  945. skeletons: Skeleton[];
  946. }>;
  947. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  948. private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
  949. private _loadExtensions();
  950. private _loadData(data);
  951. private _setupData();
  952. private _checkExtensions();
  953. private _createRootNode();
  954. private _loadNodesAsync(nodes);
  955. _loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
  956. private _getMeshes();
  957. private _getSkeletons();
  958. private _startAnimations();
  959. _loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;
  960. private _loadMeshAsync(context, node, mesh);
  961. private _loadPrimitiveAsync(context, node, mesh, primitive);
  962. private _loadVertexDataAsync(context, primitive, babylonMesh);
  963. private _createMorphTargets(context, node, mesh, primitive, babylonMesh);
  964. private _loadMorphTargetsAsync(context, primitive, babylonMesh, babylonVertexData);
  965. private _loadMorphTargetVertexDataAsync(context, babylonVertexData, attributes, babylonMorphTarget);
  966. private static _ConvertToFloat32Array(context, accessor, data);
  967. private static _ConvertVec3ToVec4(context, data);
  968. private static _LoadTransform(node, babylonNode);
  969. private _loadSkinAsync(context, node, mesh, skin);
  970. private _loadSkinInverseBindMatricesDataAsync(context, skin);
  971. private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
  972. private _loadBones(context, skin, inverseBindMatricesData);
  973. private _loadBone(node, skin, inverseBindMatricesData, babylonBones);
  974. private _getNodeMatrix(node);
  975. private _loadAnimationsAsync();
  976. private _loadAnimationAsync(context, animation);
  977. private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup);
  978. private _loadAnimationSamplerAsync(context, sampler);
  979. private _loadBufferAsync(context, buffer);
  980. _loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
  981. private _loadAccessorAsync(context, accessor);
  982. private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
  983. private _getDefaultMaterial();
  984. private _loadMaterialMetallicRoughnessPropertiesAsync(context, material);
  985. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, assign: (babylonMaterial: Material) => void): Promise<void>;
  986. _createMaterial(material: ILoaderMaterial): PBRMaterial;
  987. _loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial): Promise<void>;
  988. _loadMaterialAlphaProperties(context: string, material: ILoaderMaterial): void;
  989. _loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
  990. private _loadSampler(context, sampler);
  991. private _loadImageAsync(context, image);
  992. _loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  993. private _onProgress();
  994. static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  995. private static _GetTextureWrapMode(context, mode);
  996. private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
  997. private static _GetNumComponents(context, type);
  998. private static _ValidateUri(uri);
  999. private _compileMaterialsAsync();
  1000. private _compileShadowGeneratorsAsync();
  1001. private _clear();
  1002. _applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;
  1003. }
  1004. }
  1005. declare module BABYLON.GLTF2 {
  1006. abstract class GLTFLoaderExtension implements IGLTFLoaderExtension, IDisposable {
  1007. enabled: boolean;
  1008. readonly abstract name: string;
  1009. protected _loader: GLTFLoader;
  1010. constructor(loader: GLTFLoader);
  1011. dispose(): void;
  1012. /** Override this method to modify the default behavior for loading scenes. */
  1013. protected _loadSceneAsync(context: string, node: ILoaderScene): Nullable<Promise<void>>;
  1014. /** Override this method to modify the default behavior for loading nodes. */
  1015. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1016. /** Override this method to modify the default behavior for loading mesh primitive vertex data. */
  1017. protected _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>;
  1018. /** Override this method to modify the default behavior for loading materials. */
  1019. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, assign: (babylonMaterial: Material) => void): Nullable<Promise<void>>;
  1020. /** Override this method to modify the default behavior for loading uris. */
  1021. protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1022. /** Helper method called by a loader extension to load an glTF extension. */
  1023. protected _loadExtensionAsync<TProperty, TResult = void>(context: string, property: IProperty, actionAsync: (context: string, extension: TProperty) => Promise<TResult>): Nullable<Promise<TResult>>;
  1024. /** Helper method called by the loader to allow extensions to override loading scenes. */
  1025. static _LoadSceneAsync(loader: GLTFLoader, context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1026. /** Helper method called by the loader to allow extensions to override loading nodes. */
  1027. static _LoadNodeAsync(loader: GLTFLoader, context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1028. /** Helper method called by the loader to allow extensions to override loading mesh primitive vertex data. */
  1029. static _LoadVertexDataAsync(loader: GLTFLoader, context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>;
  1030. /** Helper method called by the loader to allow extensions to override loading materials. */
  1031. static _LoadMaterialAsync(loader: GLTFLoader, context: string, material: ILoaderMaterial, babylonMesh: Mesh, assign: (babylonMaterial: Material) => void): Nullable<Promise<void>>;
  1032. /** Helper method called by the loader to allow extensions to override loading uris. */
  1033. static _LoadUriAsync(loader: GLTFLoader, context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1034. }
  1035. }
  1036. declare module BABYLON.GLTF2.Extensions {
  1037. class MSFT_lod extends GLTFLoaderExtension {
  1038. readonly name: string;
  1039. /**
  1040. * Maximum number of LODs to load, starting from the lowest LOD.
  1041. */
  1042. maxLODsToLoad: number;
  1043. private _loadingNodeLOD;
  1044. private _loadNodeSignals;
  1045. private _loadingMaterialLOD;
  1046. private _loadMaterialSignals;
  1047. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1048. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, assign: (babylonMaterial: Material) => void): Nullable<Promise<void>>;
  1049. protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1050. /**
  1051. * Gets an array of LOD properties from lowest to highest.
  1052. */
  1053. private _getLODs<T>(context, property, array, ids);
  1054. }
  1055. }
  1056. declare module BABYLON.GLTF2.Extensions {
  1057. class KHR_draco_mesh_compression extends GLTFLoaderExtension {
  1058. readonly name: string;
  1059. private _dracoCompression;
  1060. constructor(loader: GLTFLoader);
  1061. dispose(): void;
  1062. protected _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>;
  1063. }
  1064. }
  1065. declare module BABYLON.GLTF2.Extensions {
  1066. class KHR_materials_pbrSpecularGlossiness extends GLTFLoaderExtension {
  1067. readonly name: string;
  1068. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, assign: (babylonMaterial: Material) => void): Nullable<Promise<void>>;
  1069. private _loadSpecularGlossinessPropertiesAsync(context, material, properties);
  1070. }
  1071. }
  1072. declare module BABYLON.GLTF2.Extensions {
  1073. class KHR_lights extends GLTFLoaderExtension {
  1074. readonly name: string;
  1075. protected _loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1076. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1077. private readonly _lights;
  1078. }
  1079. }