babylonjs.loaders.module.d.ts 45 KB

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