babylonjs.loaders.module.d.ts 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  1. /// <reference types="babylonjs"/>
  2. declare module 'babylonjs-loaders' {
  3. export = BABYLON;
  4. }
  5. declare module BABYLON {
  6. class STLFileLoader implements ISceneLoaderPlugin {
  7. solidPattern: RegExp;
  8. facetsPattern: RegExp;
  9. normalPattern: RegExp;
  10. vertexPattern: RegExp;
  11. name: string;
  12. extensions: ISceneLoaderPluginExtensions;
  13. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  14. load(scene: Scene, data: any, rootUrl: string): boolean;
  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, 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. /**
  80. * Read the OBJ file and create an Array of meshes.
  81. * Each mesh contains all information given by the OBJ and the MTL file.
  82. * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
  83. *
  84. * @param meshesNames
  85. * @param scene BABYLON.Scene The scene where are displayed the data
  86. * @param data String The content of the obj file
  87. * @param rootUrl String The path to the folder
  88. * @returns Array<AbstractMesh>
  89. * @private
  90. */
  91. private _parseSolid(meshesNames, scene, data, rootUrl);
  92. }
  93. }
  94. declare module BABYLON {
  95. enum GLTFLoaderCoordinateSystemMode {
  96. /**
  97. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  98. */
  99. AUTO = 0,
  100. /**
  101. * Sets the useRightHandedSystem flag on the scene.
  102. */
  103. FORCE_RIGHT_HANDED = 1,
  104. }
  105. enum GLTFLoaderAnimationStartMode {
  106. /**
  107. * No animation will start.
  108. */
  109. NONE = 0,
  110. /**
  111. * The first animation will start.
  112. */
  113. FIRST = 1,
  114. /**
  115. * All animations will start.
  116. */
  117. ALL = 2,
  118. }
  119. interface IGLTFLoaderData {
  120. json: Object;
  121. bin: Nullable<ArrayBufferView>;
  122. }
  123. interface IGLTFLoader extends IDisposable {
  124. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
  125. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
  126. }
  127. class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  128. static CreateGLTFLoaderV1: (parent: GLTFFileLoader) => IGLTFLoader;
  129. static CreateGLTFLoaderV2: (parent: GLTFFileLoader) => IGLTFLoader;
  130. /**
  131. * Raised when the asset has been parsed.
  132. * The data.json property stores the glTF JSON.
  133. * The data.bin property stores the BIN chunk from a glTF binary or null if the input is not a glTF binary.
  134. */
  135. onParsed: (data: IGLTFLoaderData) => void;
  136. static IncrementalLoading: boolean;
  137. static HomogeneousCoordinates: boolean;
  138. /**
  139. * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
  140. */
  141. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  142. /**
  143. * The animation start mode (NONE, FIRST, ALL).
  144. */
  145. animationStartMode: GLTFLoaderAnimationStartMode;
  146. /**
  147. * Set to true to compile materials before raising the success callback.
  148. */
  149. compileMaterials: boolean;
  150. /**
  151. * Set to true to also compile materials with clip planes.
  152. */
  153. useClipPlane: boolean;
  154. /**
  155. * Set to true to compile shadow generators before raising the success callback.
  156. */
  157. compileShadowGenerators: boolean;
  158. /**
  159. * Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  160. */
  161. onMeshLoaded: (mesh: AbstractMesh) => void;
  162. /**
  163. * Raised when the loader creates a texture after parsing the glTF properties of the texture.
  164. */
  165. onTextureLoaded: (texture: BaseTexture) => void;
  166. /**
  167. * Raised when the loader creates a material after parsing the glTF properties of the material.
  168. */
  169. onMaterialLoaded: (material: Material) => void;
  170. /**
  171. * Raised when the asset is completely loaded, immediately before the loader is disposed.
  172. * For assets with LODs, raised when all of the LODs are complete.
  173. * For assets without LODs, raised when the model is complete, immediately after onSuccess.
  174. */
  175. onComplete: () => void;
  176. private _loader;
  177. name: string;
  178. extensions: ISceneLoaderPluginExtensions;
  179. /**
  180. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  181. */
  182. dispose(): void;
  183. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  184. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  185. canDirectLoad(data: string): boolean;
  186. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  187. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  188. private static _parse(data);
  189. private _getLoader(loaderData);
  190. private static _parseBinary(data);
  191. private static _parseV1(binaryReader);
  192. private static _parseV2(binaryReader);
  193. private static _parseVersion(version);
  194. private static _compareVersion(a, b);
  195. private static _decodeBufferToText(buffer);
  196. }
  197. }
  198. declare module BABYLON.GLTF1 {
  199. /**
  200. * Enums
  201. */
  202. enum EComponentType {
  203. BYTE = 5120,
  204. UNSIGNED_BYTE = 5121,
  205. SHORT = 5122,
  206. UNSIGNED_SHORT = 5123,
  207. FLOAT = 5126,
  208. }
  209. enum EShaderType {
  210. FRAGMENT = 35632,
  211. VERTEX = 35633,
  212. }
  213. enum EParameterType {
  214. BYTE = 5120,
  215. UNSIGNED_BYTE = 5121,
  216. SHORT = 5122,
  217. UNSIGNED_SHORT = 5123,
  218. INT = 5124,
  219. UNSIGNED_INT = 5125,
  220. FLOAT = 5126,
  221. FLOAT_VEC2 = 35664,
  222. FLOAT_VEC3 = 35665,
  223. FLOAT_VEC4 = 35666,
  224. INT_VEC2 = 35667,
  225. INT_VEC3 = 35668,
  226. INT_VEC4 = 35669,
  227. BOOL = 35670,
  228. BOOL_VEC2 = 35671,
  229. BOOL_VEC3 = 35672,
  230. BOOL_VEC4 = 35673,
  231. FLOAT_MAT2 = 35674,
  232. FLOAT_MAT3 = 35675,
  233. FLOAT_MAT4 = 35676,
  234. SAMPLER_2D = 35678,
  235. }
  236. enum ETextureWrapMode {
  237. CLAMP_TO_EDGE = 33071,
  238. MIRRORED_REPEAT = 33648,
  239. REPEAT = 10497,
  240. }
  241. enum ETextureFilterType {
  242. NEAREST = 9728,
  243. LINEAR = 9728,
  244. NEAREST_MIPMAP_NEAREST = 9984,
  245. LINEAR_MIPMAP_NEAREST = 9985,
  246. NEAREST_MIPMAP_LINEAR = 9986,
  247. LINEAR_MIPMAP_LINEAR = 9987,
  248. }
  249. enum ETextureFormat {
  250. ALPHA = 6406,
  251. RGB = 6407,
  252. RGBA = 6408,
  253. LUMINANCE = 6409,
  254. LUMINANCE_ALPHA = 6410,
  255. }
  256. enum ECullingType {
  257. FRONT = 1028,
  258. BACK = 1029,
  259. FRONT_AND_BACK = 1032,
  260. }
  261. enum EBlendingFunction {
  262. ZERO = 0,
  263. ONE = 1,
  264. SRC_COLOR = 768,
  265. ONE_MINUS_SRC_COLOR = 769,
  266. DST_COLOR = 774,
  267. ONE_MINUS_DST_COLOR = 775,
  268. SRC_ALPHA = 770,
  269. ONE_MINUS_SRC_ALPHA = 771,
  270. DST_ALPHA = 772,
  271. ONE_MINUS_DST_ALPHA = 773,
  272. CONSTANT_COLOR = 32769,
  273. ONE_MINUS_CONSTANT_COLOR = 32770,
  274. CONSTANT_ALPHA = 32771,
  275. ONE_MINUS_CONSTANT_ALPHA = 32772,
  276. SRC_ALPHA_SATURATE = 776,
  277. }
  278. /**
  279. * Interfaces
  280. */
  281. interface IGLTFProperty {
  282. extensions?: {
  283. [key: string]: any;
  284. };
  285. extras?: Object;
  286. }
  287. interface IGLTFChildRootProperty extends IGLTFProperty {
  288. name?: string;
  289. }
  290. interface IGLTFAccessor extends IGLTFChildRootProperty {
  291. bufferView: string;
  292. byteOffset: number;
  293. byteStride: number;
  294. count: number;
  295. type: string;
  296. componentType: EComponentType;
  297. max?: number[];
  298. min?: number[];
  299. name?: string;
  300. }
  301. interface IGLTFBufferView extends IGLTFChildRootProperty {
  302. buffer: string;
  303. byteOffset: number;
  304. byteLength: number;
  305. byteStride: number;
  306. target?: number;
  307. }
  308. interface IGLTFBuffer extends IGLTFChildRootProperty {
  309. uri: string;
  310. byteLength?: number;
  311. type?: string;
  312. }
  313. interface IGLTFShader extends IGLTFChildRootProperty {
  314. uri: string;
  315. type: EShaderType;
  316. }
  317. interface IGLTFProgram extends IGLTFChildRootProperty {
  318. attributes: string[];
  319. fragmentShader: string;
  320. vertexShader: string;
  321. }
  322. interface IGLTFTechniqueParameter {
  323. type: number;
  324. count?: number;
  325. semantic?: string;
  326. node?: string;
  327. value?: number | boolean | string | Array<any>;
  328. source?: string;
  329. babylonValue?: any;
  330. }
  331. interface IGLTFTechniqueCommonProfile {
  332. lightingModel: string;
  333. texcoordBindings: Object;
  334. parameters?: Array<any>;
  335. }
  336. interface IGLTFTechniqueStatesFunctions {
  337. blendColor?: number[];
  338. blendEquationSeparate?: number[];
  339. blendFuncSeparate?: number[];
  340. colorMask: boolean[];
  341. cullFace: number[];
  342. }
  343. interface IGLTFTechniqueStates {
  344. enable: number[];
  345. functions: IGLTFTechniqueStatesFunctions;
  346. }
  347. interface IGLTFTechnique extends IGLTFChildRootProperty {
  348. parameters: {
  349. [key: string]: IGLTFTechniqueParameter;
  350. };
  351. program: string;
  352. attributes: {
  353. [key: string]: string;
  354. };
  355. uniforms: {
  356. [key: string]: string;
  357. };
  358. states: IGLTFTechniqueStates;
  359. }
  360. interface IGLTFMaterial extends IGLTFChildRootProperty {
  361. technique?: string;
  362. values: string[];
  363. }
  364. interface IGLTFMeshPrimitive extends IGLTFProperty {
  365. attributes: {
  366. [key: string]: string;
  367. };
  368. indices: string;
  369. material: string;
  370. mode?: number;
  371. }
  372. interface IGLTFMesh extends IGLTFChildRootProperty {
  373. primitives: IGLTFMeshPrimitive[];
  374. }
  375. interface IGLTFImage extends IGLTFChildRootProperty {
  376. uri: string;
  377. }
  378. interface IGLTFSampler extends IGLTFChildRootProperty {
  379. magFilter?: number;
  380. minFilter?: number;
  381. wrapS?: number;
  382. wrapT?: number;
  383. }
  384. interface IGLTFTexture extends IGLTFChildRootProperty {
  385. sampler: string;
  386. source: string;
  387. format?: ETextureFormat;
  388. internalFormat?: ETextureFormat;
  389. target?: number;
  390. type?: number;
  391. babylonTexture?: Texture;
  392. }
  393. interface IGLTFAmbienLight {
  394. color?: number[];
  395. }
  396. interface IGLTFDirectionalLight {
  397. color?: number[];
  398. }
  399. interface IGLTFPointLight {
  400. color?: number[];
  401. constantAttenuation?: number;
  402. linearAttenuation?: number;
  403. quadraticAttenuation?: number;
  404. }
  405. interface IGLTFSpotLight {
  406. color?: number[];
  407. constantAttenuation?: number;
  408. fallOfAngle?: number;
  409. fallOffExponent?: number;
  410. linearAttenuation?: number;
  411. quadraticAttenuation?: number;
  412. }
  413. interface IGLTFLight extends IGLTFChildRootProperty {
  414. type: string;
  415. }
  416. interface IGLTFCameraOrthographic {
  417. xmag: number;
  418. ymag: number;
  419. zfar: number;
  420. znear: number;
  421. }
  422. interface IGLTFCameraPerspective {
  423. aspectRatio: number;
  424. yfov: number;
  425. zfar: number;
  426. znear: number;
  427. }
  428. interface IGLTFCamera extends IGLTFChildRootProperty {
  429. type: string;
  430. }
  431. interface IGLTFAnimationChannelTarget {
  432. id: string;
  433. path: string;
  434. }
  435. interface IGLTFAnimationChannel {
  436. sampler: string;
  437. target: IGLTFAnimationChannelTarget;
  438. }
  439. interface IGLTFAnimationSampler {
  440. input: string;
  441. output: string;
  442. interpolation?: string;
  443. }
  444. interface IGLTFAnimation extends IGLTFChildRootProperty {
  445. channels?: IGLTFAnimationChannel[];
  446. parameters?: {
  447. [key: string]: string;
  448. };
  449. samplers?: {
  450. [key: string]: IGLTFAnimationSampler;
  451. };
  452. }
  453. interface IGLTFNodeInstanceSkin {
  454. skeletons: string[];
  455. skin: string;
  456. meshes: string[];
  457. }
  458. interface IGLTFSkins extends IGLTFChildRootProperty {
  459. bindShapeMatrix: number[];
  460. inverseBindMatrices: string;
  461. jointNames: string[];
  462. babylonSkeleton?: Skeleton;
  463. }
  464. interface IGLTFNode extends IGLTFChildRootProperty {
  465. camera?: string;
  466. children: string[];
  467. skin?: string;
  468. jointName?: string;
  469. light?: string;
  470. matrix: number[];
  471. mesh?: string;
  472. meshes?: string[];
  473. rotation?: number[];
  474. scale?: number[];
  475. translation?: number[];
  476. babylonNode?: Node;
  477. }
  478. interface IGLTFScene extends IGLTFChildRootProperty {
  479. nodes: string[];
  480. }
  481. /**
  482. * Runtime
  483. */
  484. interface IGLTFRuntime {
  485. extensions: {
  486. [key: string]: any;
  487. };
  488. accessors: {
  489. [key: string]: IGLTFAccessor;
  490. };
  491. buffers: {
  492. [key: string]: IGLTFBuffer;
  493. };
  494. bufferViews: {
  495. [key: string]: IGLTFBufferView;
  496. };
  497. meshes: {
  498. [key: string]: IGLTFMesh;
  499. };
  500. lights: {
  501. [key: string]: IGLTFLight;
  502. };
  503. cameras: {
  504. [key: string]: IGLTFCamera;
  505. };
  506. nodes: {
  507. [key: string]: IGLTFNode;
  508. };
  509. images: {
  510. [key: string]: IGLTFImage;
  511. };
  512. textures: {
  513. [key: string]: IGLTFTexture;
  514. };
  515. shaders: {
  516. [key: string]: IGLTFShader;
  517. };
  518. programs: {
  519. [key: string]: IGLTFProgram;
  520. };
  521. samplers: {
  522. [key: string]: IGLTFSampler;
  523. };
  524. techniques: {
  525. [key: string]: IGLTFTechnique;
  526. };
  527. materials: {
  528. [key: string]: IGLTFMaterial;
  529. };
  530. animations: {
  531. [key: string]: IGLTFAnimation;
  532. };
  533. skins: {
  534. [key: string]: IGLTFSkins;
  535. };
  536. currentScene?: Object;
  537. scenes: {
  538. [key: string]: IGLTFScene;
  539. };
  540. extensionsUsed: string[];
  541. extensionsRequired?: string[];
  542. buffersCount: number;
  543. shaderscount: number;
  544. scene: Scene;
  545. rootUrl: string;
  546. loadedBufferCount: number;
  547. loadedBufferViews: {
  548. [name: string]: ArrayBufferView;
  549. };
  550. loadedShaderCount: number;
  551. importOnlyMeshes: boolean;
  552. importMeshesNames?: string[];
  553. dummyNodes: Node[];
  554. }
  555. /**
  556. * Bones
  557. */
  558. interface INodeToRoot {
  559. bone: Bone;
  560. node: IGLTFNode;
  561. id: string;
  562. }
  563. interface IJointNode {
  564. node: IGLTFNode;
  565. id: string;
  566. }
  567. }
  568. declare module BABYLON.GLTF1 {
  569. /**
  570. * Implementation of the base glTF spec
  571. */
  572. class GLTFLoaderBase {
  573. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  574. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  575. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  576. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  577. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): void;
  578. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  579. }
  580. /**
  581. * glTF V1 Loader
  582. */
  583. class GLTFLoader implements IGLTFLoader {
  584. static Extensions: {
  585. [name: string]: GLTFLoaderExtension;
  586. };
  587. static RegisterExtension(extension: GLTFLoaderExtension): void;
  588. dispose(): void;
  589. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): boolean;
  590. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  591. private _loadShadersAsync(gltfRuntime, onload);
  592. private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?);
  593. private _createNodes(gltfRuntime);
  594. }
  595. }
  596. declare module BABYLON.GLTF1 {
  597. /**
  598. * Utils functions for GLTF
  599. */
  600. class GLTFUtils {
  601. /**
  602. * Sets the given "parameter" matrix
  603. * @param scene: the {BABYLON.Scene} object
  604. * @param source: the source node where to pick the matrix
  605. * @param parameter: the GLTF technique parameter
  606. * @param uniformName: the name of the shader's uniform
  607. * @param shaderMaterial: the shader material
  608. */
  609. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  610. /**
  611. * Sets the given "parameter" matrix
  612. * @param shaderMaterial: the shader material
  613. * @param uniform: the name of the shader's uniform
  614. * @param value: the value of the uniform
  615. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  616. */
  617. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  618. /**
  619. * If the uri is a base64 string
  620. * @param uri: the uri to test
  621. */
  622. static IsBase64(uri: string): boolean;
  623. /**
  624. * Decode the base64 uri
  625. * @param uri: the uri to decode
  626. */
  627. static DecodeBase64(uri: string): ArrayBuffer;
  628. /**
  629. * Returns the wrap mode of the texture
  630. * @param mode: the mode value
  631. */
  632. static GetWrapMode(mode: number): number;
  633. /**
  634. * Returns the byte stride giving an accessor
  635. * @param accessor: the GLTF accessor objet
  636. */
  637. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  638. /**
  639. * Returns the texture filter mode giving a mode value
  640. * @param mode: the filter mode value
  641. */
  642. static GetTextureFilterMode(mode: number): ETextureFilterType;
  643. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  644. /**
  645. * Returns a buffer from its accessor
  646. * @param gltfRuntime: the GLTF runtime
  647. * @param accessor: the GLTF accessor
  648. */
  649. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  650. /**
  651. * Decodes a buffer view into a string
  652. * @param view: the buffer view
  653. */
  654. static DecodeBufferToText(view: ArrayBufferView): string;
  655. /**
  656. * Returns the default material of gltf. Related to
  657. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  658. * @param scene: the Babylon.js scene
  659. */
  660. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  661. private static _DefaultMaterial;
  662. }
  663. }
  664. declare module BABYLON.GLTF1 {
  665. abstract class GLTFLoaderExtension {
  666. private _name;
  667. constructor(name: string);
  668. readonly name: string;
  669. /**
  670. * Defines an override for loading the runtime
  671. * Return true to stop further extensions from loading the runtime
  672. */
  673. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  674. /**
  675. * Defines an onverride for creating gltf runtime
  676. * Return true to stop further extensions from creating the runtime
  677. */
  678. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  679. /**
  680. * Defines an override for loading buffers
  681. * Return true to stop further extensions from loading this buffer
  682. */
  683. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  684. /**
  685. * Defines an override for loading texture buffers
  686. * Return true to stop further extensions from loading this texture data
  687. */
  688. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  689. /**
  690. * Defines an override for creating textures
  691. * Return true to stop further extensions from loading this texture
  692. */
  693. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  694. /**
  695. * Defines an override for loading shader strings
  696. * Return true to stop further extensions from loading this shader data
  697. */
  698. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  699. /**
  700. * Defines an override for loading materials
  701. * Return true to stop further extensions from loading this material
  702. */
  703. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  704. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): void;
  705. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): void;
  706. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  707. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  708. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string) => void, onError: (message: string) => void): void;
  709. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  710. private static LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);
  711. private static CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
  712. private static ApplyExtensions(func, defaultFunc);
  713. }
  714. }
  715. declare module BABYLON.GLTF1 {
  716. class GLTFBinaryExtension extends GLTFLoaderExtension {
  717. private _bin;
  718. constructor();
  719. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  720. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  721. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  722. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  723. }
  724. }
  725. declare module BABYLON.GLTF1 {
  726. class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  727. constructor();
  728. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  729. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  730. private _loadTexture(gltfRuntime, id, material, propertyPath, onError);
  731. }
  732. }
  733. declare module BABYLON.GLTF2 {
  734. /**
  735. * Enums
  736. */
  737. enum EComponentType {
  738. BYTE = 5120,
  739. UNSIGNED_BYTE = 5121,
  740. SHORT = 5122,
  741. UNSIGNED_SHORT = 5123,
  742. UNSIGNED_INT = 5125,
  743. FLOAT = 5126,
  744. }
  745. enum EMeshPrimitiveMode {
  746. POINTS = 0,
  747. LINES = 1,
  748. LINE_LOOP = 2,
  749. LINE_STRIP = 3,
  750. TRIANGLES = 4,
  751. TRIANGLE_STRIP = 5,
  752. TRIANGLE_FAN = 6,
  753. }
  754. enum ETextureMagFilter {
  755. NEAREST = 9728,
  756. LINEAR = 9729,
  757. }
  758. enum ETextureMinFilter {
  759. NEAREST = 9728,
  760. LINEAR = 9729,
  761. NEAREST_MIPMAP_NEAREST = 9984,
  762. LINEAR_MIPMAP_NEAREST = 9985,
  763. NEAREST_MIPMAP_LINEAR = 9986,
  764. LINEAR_MIPMAP_LINEAR = 9987,
  765. }
  766. enum ETextureWrapMode {
  767. CLAMP_TO_EDGE = 33071,
  768. MIRRORED_REPEAT = 33648,
  769. REPEAT = 10497,
  770. }
  771. /**
  772. * Interfaces
  773. */
  774. interface IGLTFProperty {
  775. extensions?: {
  776. [key: string]: any;
  777. };
  778. extras?: any;
  779. }
  780. interface IGLTFChildRootProperty extends IGLTFProperty {
  781. name?: string;
  782. }
  783. interface IGLTFAccessorSparseIndices extends IGLTFProperty {
  784. bufferView: number;
  785. byteOffset?: number;
  786. componentType: EComponentType;
  787. }
  788. interface IGLTFAccessorSparseValues extends IGLTFProperty {
  789. bufferView: number;
  790. byteOffset?: number;
  791. }
  792. interface IGLTFAccessorSparse extends IGLTFProperty {
  793. count: number;
  794. indices: IGLTFAccessorSparseIndices;
  795. values: IGLTFAccessorSparseValues;
  796. }
  797. interface IGLTFAccessor extends IGLTFChildRootProperty {
  798. bufferView?: number;
  799. byteOffset?: number;
  800. componentType: EComponentType;
  801. normalized?: boolean;
  802. count: number;
  803. type: string;
  804. max: number[];
  805. min: number[];
  806. sparse?: IGLTFAccessorSparse;
  807. index: number;
  808. }
  809. interface IGLTFAnimationChannel extends IGLTFProperty {
  810. sampler: number;
  811. target: IGLTFAnimationChannelTarget;
  812. }
  813. interface IGLTFAnimationChannelTarget extends IGLTFProperty {
  814. node: number;
  815. path: string;
  816. }
  817. interface IGLTFAnimationSampler extends IGLTFProperty {
  818. input: number;
  819. interpolation?: string;
  820. output: number;
  821. }
  822. interface IGLTFAnimation extends IGLTFChildRootProperty {
  823. channels: IGLTFAnimationChannel[];
  824. samplers: IGLTFAnimationSampler[];
  825. index: number;
  826. targets: any[];
  827. }
  828. interface IGLTFAsset extends IGLTFChildRootProperty {
  829. copyright?: string;
  830. generator?: string;
  831. version: string;
  832. minVersion?: string;
  833. }
  834. interface IGLTFBuffer extends IGLTFChildRootProperty {
  835. uri?: string;
  836. byteLength: number;
  837. index: number;
  838. loadedData?: ArrayBufferView;
  839. loadedObservable?: Observable<IGLTFBuffer>;
  840. }
  841. interface IGLTFBufferView extends IGLTFChildRootProperty {
  842. buffer: number;
  843. byteOffset?: number;
  844. byteLength: number;
  845. byteStride?: number;
  846. index: number;
  847. }
  848. interface IGLTFCameraOrthographic extends IGLTFProperty {
  849. xmag: number;
  850. ymag: number;
  851. zfar: number;
  852. znear: number;
  853. }
  854. interface IGLTFCameraPerspective extends IGLTFProperty {
  855. aspectRatio: number;
  856. yfov: number;
  857. zfar: number;
  858. znear: number;
  859. }
  860. interface IGLTFCamera extends IGLTFChildRootProperty {
  861. orthographic?: IGLTFCameraOrthographic;
  862. perspective?: IGLTFCameraPerspective;
  863. type: string;
  864. }
  865. interface IGLTFImage extends IGLTFChildRootProperty {
  866. uri?: string;
  867. mimeType?: string;
  868. bufferView?: number;
  869. index: number;
  870. }
  871. interface IGLTFMaterialNormalTextureInfo extends IGLTFTextureInfo {
  872. scale: number;
  873. }
  874. interface IGLTFMaterialOcclusionTextureInfo extends IGLTFTextureInfo {
  875. strength: number;
  876. }
  877. interface IGLTFMaterialPbrMetallicRoughness {
  878. baseColorFactor: number[];
  879. baseColorTexture: IGLTFTextureInfo;
  880. metallicFactor: number;
  881. roughnessFactor: number;
  882. metallicRoughnessTexture: IGLTFTextureInfo;
  883. }
  884. interface IGLTFMaterial extends IGLTFChildRootProperty {
  885. pbrMetallicRoughness?: IGLTFMaterialPbrMetallicRoughness;
  886. normalTexture?: IGLTFMaterialNormalTextureInfo;
  887. occlusionTexture?: IGLTFMaterialOcclusionTextureInfo;
  888. emissiveTexture?: IGLTFTextureInfo;
  889. emissiveFactor?: number[];
  890. alphaMode?: string;
  891. alphaCutoff: number;
  892. doubleSided?: boolean;
  893. index: number;
  894. babylonMaterial: Material;
  895. }
  896. interface IGLTFMeshPrimitive extends IGLTFProperty {
  897. attributes: {
  898. [name: string]: number;
  899. };
  900. indices?: number;
  901. material?: number;
  902. mode?: EMeshPrimitiveMode;
  903. targets?: {
  904. [name: string]: number;
  905. }[];
  906. vertexData: VertexData;
  907. targetsVertexData: VertexData[];
  908. }
  909. interface IGLTFMesh extends IGLTFChildRootProperty {
  910. primitives: IGLTFMeshPrimitive[];
  911. weights?: number[];
  912. index: number;
  913. }
  914. interface IGLTFNode extends IGLTFChildRootProperty {
  915. camera?: number;
  916. children?: number[];
  917. skin?: number;
  918. matrix?: number[];
  919. mesh?: number;
  920. rotation?: number[];
  921. scale?: number[];
  922. translation?: number[];
  923. weights?: number[];
  924. index: number;
  925. parent: IGLTFNode;
  926. babylonMesh: Mesh;
  927. babylonAnimationTargets?: Node[];
  928. }
  929. interface IGLTFSampler extends IGLTFChildRootProperty {
  930. magFilter?: ETextureMagFilter;
  931. minFilter?: ETextureMinFilter;
  932. wrapS?: ETextureWrapMode;
  933. wrapT?: ETextureWrapMode;
  934. }
  935. interface IGLTFScene extends IGLTFChildRootProperty {
  936. nodes: number[];
  937. index: number;
  938. }
  939. interface IGLTFSkin extends IGLTFChildRootProperty {
  940. inverseBindMatrices?: number;
  941. skeleton?: number;
  942. joints: number[];
  943. index: number;
  944. babylonSkeleton: Skeleton;
  945. }
  946. interface IGLTFTexture extends IGLTFChildRootProperty {
  947. sampler?: number;
  948. source: number;
  949. index: number;
  950. url?: string;
  951. dataReadyObservable?: Observable<IGLTFTexture>;
  952. }
  953. interface IGLTFTextureInfo {
  954. index: number;
  955. texCoord?: number;
  956. }
  957. interface IGLTF extends IGLTFProperty {
  958. accessors?: IGLTFAccessor[];
  959. animations?: IGLTFAnimation[];
  960. asset: IGLTFAsset;
  961. buffers?: IGLTFBuffer[];
  962. bufferViews?: IGLTFBufferView[];
  963. cameras?: IGLTFCamera[];
  964. extensionsUsed?: string[];
  965. extensionsRequired?: string[];
  966. images?: IGLTFImage[];
  967. materials?: IGLTFMaterial[];
  968. meshes?: IGLTFMesh[];
  969. nodes?: IGLTFNode[];
  970. samplers?: IGLTFSampler[];
  971. scene?: number;
  972. scenes?: IGLTFScene[];
  973. skins?: IGLTFSkin[];
  974. textures?: IGLTFTexture[];
  975. }
  976. }
  977. declare module BABYLON.GLTF2 {
  978. class GLTFLoader implements IGLTFLoader {
  979. _gltf: IGLTF;
  980. _babylonScene: Scene;
  981. private _disposed;
  982. private _parent;
  983. private _rootUrl;
  984. private _defaultMaterial;
  985. private _rootNode;
  986. private _successCallback;
  987. private _progressCallback;
  988. private _errorCallback;
  989. private _renderReady;
  990. private _requests;
  991. private _renderReadyObservable;
  992. private _renderPendingCount;
  993. private _loaderPendingCount;
  994. private _loaderTrackers;
  995. static Extensions: {
  996. [name: string]: GLTFLoaderExtension;
  997. };
  998. static RegisterExtension(extension: GLTFLoaderExtension): void;
  999. private static _progressEventFactory;
  1000. private static _createProgressEventByConstructor(name, data);
  1001. private static _createProgressEventByDocument(name, data);
  1002. constructor(parent: GLTFFileLoader);
  1003. dispose(): void;
  1004. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  1005. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  1006. private _loadAsync(nodeNames, scene, data, rootUrl, onSuccess, onProgress, onError);
  1007. private _onProgress();
  1008. _executeWhenRenderReady(func: () => void): void;
  1009. private _onRenderReady();
  1010. private _onComplete();
  1011. private _loadData(data);
  1012. private _getMeshes();
  1013. private _getSkeletons();
  1014. private _startAnimations();
  1015. private _loadDefaultScene(nodeNames);
  1016. private _loadScene(context, scene, nodeNames);
  1017. _loadNode(context: string, node: IGLTFNode): void;
  1018. private _loadMesh(context, node, mesh);
  1019. private _loadAllVertexDataAsync(context, mesh, onSuccess);
  1020. /**
  1021. * Converts a data bufferview into a Float4 Texture Coordinate Array, based on the accessor component type
  1022. * @param {ArrayBufferView} data
  1023. * @param {IGLTFAccessor} accessor
  1024. */
  1025. private _convertToFloat4TextureCoordArray(context, data, accessor);
  1026. /**
  1027. * Converts a data bufferview into a Float4 Color Array, based on the accessor component type
  1028. * @param {ArrayBufferView} data
  1029. * @param {IGLTFAccessor} accessor
  1030. */
  1031. private _convertToFloat4ColorArray(context, data, accessor);
  1032. private _loadVertexDataAsync(context, mesh, primitive, onSuccess);
  1033. private _createMorphTargets(context, node, mesh);
  1034. private _loadMorphTargets(context, node, mesh);
  1035. private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
  1036. private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
  1037. private _loadTransform(node);
  1038. private _loadSkinAsync(context, skin, onSuccess);
  1039. private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
  1040. private _loadBones(context, skin, inverseBindMatrixData);
  1041. private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
  1042. private _getNodeMatrix(node);
  1043. private _traverseNodes(context, indices, action, parentNode);
  1044. _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void;
  1045. private _loadAnimations();
  1046. private _loadAnimation(context, animation);
  1047. private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
  1048. private _loadBufferAsync(context, buffer, onSuccess);
  1049. private _loadBufferViewAsync(context, bufferView, onSuccess);
  1050. private _loadAccessorAsync(context, accessor, onSuccess);
  1051. private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
  1052. _addPendingData(data: any): void;
  1053. _removePendingData(data: any): void;
  1054. _addLoaderPendingData(data: any): void;
  1055. _removeLoaderPendingData(data: any): void;
  1056. _whenAction(action: () => void, onComplete: () => void): void;
  1057. private _getDefaultMaterial();
  1058. private _loadMaterialMetallicRoughnessProperties(context, material);
  1059. _loadMaterial(context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): void;
  1060. _createPbrMaterial(material: IGLTFMaterial): void;
  1061. _loadMaterialBaseProperties(context: string, material: IGLTFMaterial): void;
  1062. _loadMaterialAlphaProperties(context: string, material: IGLTFMaterial, colorFactor: number[]): void;
  1063. _loadTexture(context: string, texture: IGLTFTexture, coordinatesIndex?: number): Texture;
  1064. private _loadImageAsync(context, image, onSuccess);
  1065. _loadUriAsync(context: string, uri: string, onSuccess: (data: ArrayBufferView) => void): void;
  1066. _tryCatchOnError(handler: () => void): void;
  1067. private static _AssignIndices(array?);
  1068. static _GetProperty<T extends IGLTFProperty>(array?: ArrayLike<T>, index?: number): Nullable<T>;
  1069. private static _GetTextureWrapMode(mode?);
  1070. private static _GetTextureSamplingMode(magFilter?, minFilter?);
  1071. private static _GetNumComponents(type);
  1072. private _compileMaterialAsync(babylonMaterial, babylonMesh, onSuccess);
  1073. private _compileMaterialsAsync(onSuccess);
  1074. private _compileShadowGeneratorsAsync(onSuccess);
  1075. }
  1076. }
  1077. declare module BABYLON.GLTF2 {
  1078. /**
  1079. * Utils functions for GLTF
  1080. */
  1081. class GLTFUtils {
  1082. /**
  1083. * If the uri is a base64 string
  1084. * @param uri: the uri to test
  1085. */
  1086. static IsBase64(uri: string): boolean;
  1087. /**
  1088. * Decode the base64 uri
  1089. * @param uri: the uri to decode
  1090. */
  1091. static DecodeBase64(uri: string): ArrayBuffer;
  1092. static ValidateUri(uri: string): boolean;
  1093. }
  1094. }
  1095. declare module BABYLON.GLTF2 {
  1096. abstract class GLTFLoaderExtension {
  1097. enabled: boolean;
  1098. readonly abstract name: string;
  1099. protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
  1100. protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
  1101. protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  1102. protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
  1103. static _Extensions: GLTFLoaderExtension[];
  1104. static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
  1105. static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
  1106. static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  1107. private static _ApplyExtensions(action);
  1108. }
  1109. }
  1110. declare module BABYLON.GLTF2.Extensions {
  1111. class MSFTLOD extends GLTFLoaderExtension {
  1112. /**
  1113. * Specify the minimal delay between LODs in ms (default = 250)
  1114. */
  1115. Delay: number;
  1116. readonly name: string;
  1117. protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
  1118. protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
  1119. private _loadNodeLOD(loader, context, nodes, index, onComplete);
  1120. protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  1121. private _loadMaterialLOD(loader, context, materials, index, assign, onComplete);
  1122. }
  1123. }
  1124. declare module BABYLON.GLTF2.Extensions {
  1125. class KHRMaterialsPbrSpecularGlossiness extends GLTFLoaderExtension {
  1126. readonly name: string;
  1127. protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  1128. private _loadSpecularGlossinessProperties(loader, context, material, properties);
  1129. }
  1130. }