babylon.glTF1FileLoader.d.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. declare module BABYLON {
  2. enum GLTFLoaderCoordinateSystemMode {
  3. AUTO = 0,
  4. PASS_THROUGH = 1,
  5. FORCE_RIGHT_HANDED = 2,
  6. }
  7. interface IGLTFLoaderData {
  8. json: Object;
  9. bin: ArrayBufferView;
  10. }
  11. interface IGLTFLoader {
  12. 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;
  13. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
  14. }
  15. class GLTFFileLoader implements ISceneLoaderPluginAsync {
  16. static CreateGLTFLoaderV1: (parent: GLTFFileLoader) => IGLTFLoader;
  17. static CreateGLTFLoaderV2: (parent: GLTFFileLoader) => IGLTFLoader;
  18. onParsed: (data: IGLTFLoaderData) => void;
  19. static HomogeneousCoordinates: boolean;
  20. static IncrementalLoading: boolean;
  21. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  22. onTextureLoaded: (texture: BaseTexture) => void;
  23. onMaterialLoaded: (material: Material) => void;
  24. /**
  25. * Let the user decides if he needs to process the material (like precompilation) before affecting it to meshes
  26. */
  27. onBeforeMaterialReadyAsync: (material: Material, targetMesh: AbstractMesh, isLOD: boolean, callback: () => void) => void;
  28. /**
  29. * Raised when the visible components (geometry, materials, textures, etc.) are first ready to be rendered.
  30. * For assets with LODs, raised when the first LOD is complete.
  31. * For assets without LODs, raised when the model is complete just before onComplete.
  32. */
  33. onReady: () => void;
  34. /**
  35. * Raised when the asset is completely loaded, just before the loader is disposed.
  36. * For assets with LODs, raised when all of the LODs are complete.
  37. * For assets without LODs, raised when the model is complete just after onReady.
  38. */
  39. onComplete: () => void;
  40. name: string;
  41. extensions: ISceneLoaderPluginExtensions;
  42. 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;
  43. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  44. canDirectLoad(data: string): boolean;
  45. private static _parse(data, onError);
  46. private _getLoader(loaderData, onError);
  47. private static _parseBinary(data, onError);
  48. private static _parseV1(binaryReader, onError);
  49. private static _parseV2(binaryReader, onError);
  50. private static _parseVersion(version);
  51. private static _compareVersion(a, b);
  52. private static _decodeBufferToText(view);
  53. }
  54. }
  55. declare module BABYLON.GLTF1 {
  56. /**
  57. * Enums
  58. */
  59. enum EComponentType {
  60. BYTE = 5120,
  61. UNSIGNED_BYTE = 5121,
  62. SHORT = 5122,
  63. UNSIGNED_SHORT = 5123,
  64. FLOAT = 5126,
  65. }
  66. enum EShaderType {
  67. FRAGMENT = 35632,
  68. VERTEX = 35633,
  69. }
  70. enum EParameterType {
  71. BYTE = 5120,
  72. UNSIGNED_BYTE = 5121,
  73. SHORT = 5122,
  74. UNSIGNED_SHORT = 5123,
  75. INT = 5124,
  76. UNSIGNED_INT = 5125,
  77. FLOAT = 5126,
  78. FLOAT_VEC2 = 35664,
  79. FLOAT_VEC3 = 35665,
  80. FLOAT_VEC4 = 35666,
  81. INT_VEC2 = 35667,
  82. INT_VEC3 = 35668,
  83. INT_VEC4 = 35669,
  84. BOOL = 35670,
  85. BOOL_VEC2 = 35671,
  86. BOOL_VEC3 = 35672,
  87. BOOL_VEC4 = 35673,
  88. FLOAT_MAT2 = 35674,
  89. FLOAT_MAT3 = 35675,
  90. FLOAT_MAT4 = 35676,
  91. SAMPLER_2D = 35678,
  92. }
  93. enum ETextureWrapMode {
  94. CLAMP_TO_EDGE = 33071,
  95. MIRRORED_REPEAT = 33648,
  96. REPEAT = 10497,
  97. }
  98. enum ETextureFilterType {
  99. NEAREST = 9728,
  100. LINEAR = 9728,
  101. NEAREST_MIPMAP_NEAREST = 9984,
  102. LINEAR_MIPMAP_NEAREST = 9985,
  103. NEAREST_MIPMAP_LINEAR = 9986,
  104. LINEAR_MIPMAP_LINEAR = 9987,
  105. }
  106. enum ETextureFormat {
  107. ALPHA = 6406,
  108. RGB = 6407,
  109. RGBA = 6408,
  110. LUMINANCE = 6409,
  111. LUMINANCE_ALPHA = 6410,
  112. }
  113. enum ECullingType {
  114. FRONT = 1028,
  115. BACK = 1029,
  116. FRONT_AND_BACK = 1032,
  117. }
  118. enum EBlendingFunction {
  119. ZERO = 0,
  120. ONE = 1,
  121. SRC_COLOR = 768,
  122. ONE_MINUS_SRC_COLOR = 769,
  123. DST_COLOR = 774,
  124. ONE_MINUS_DST_COLOR = 775,
  125. SRC_ALPHA = 770,
  126. ONE_MINUS_SRC_ALPHA = 771,
  127. DST_ALPHA = 772,
  128. ONE_MINUS_DST_ALPHA = 773,
  129. CONSTANT_COLOR = 32769,
  130. ONE_MINUS_CONSTANT_COLOR = 32770,
  131. CONSTANT_ALPHA = 32771,
  132. ONE_MINUS_CONSTANT_ALPHA = 32772,
  133. SRC_ALPHA_SATURATE = 776,
  134. }
  135. /**
  136. * Interfaces
  137. */
  138. interface IGLTFProperty {
  139. extensions?: {
  140. [key: string]: any;
  141. };
  142. extras?: Object;
  143. }
  144. interface IGLTFChildRootProperty extends IGLTFProperty {
  145. name?: string;
  146. }
  147. interface IGLTFAccessor extends IGLTFChildRootProperty {
  148. bufferView: string;
  149. byteOffset: number;
  150. byteStride: number;
  151. count: number;
  152. type: string;
  153. componentType: EComponentType;
  154. max?: number[];
  155. min?: number[];
  156. name?: string;
  157. }
  158. interface IGLTFBufferView extends IGLTFChildRootProperty {
  159. buffer: string;
  160. byteOffset: number;
  161. byteLength: number;
  162. byteStride: number;
  163. target?: number;
  164. }
  165. interface IGLTFBuffer extends IGLTFChildRootProperty {
  166. uri: string;
  167. byteLength?: number;
  168. type?: string;
  169. }
  170. interface IGLTFShader extends IGLTFChildRootProperty {
  171. uri: string;
  172. type: EShaderType;
  173. }
  174. interface IGLTFProgram extends IGLTFChildRootProperty {
  175. attributes: string[];
  176. fragmentShader: string;
  177. vertexShader: string;
  178. }
  179. interface IGLTFTechniqueParameter {
  180. type: number;
  181. count?: number;
  182. semantic?: string;
  183. node?: string;
  184. value?: number | boolean | string | Array<any>;
  185. source?: string;
  186. babylonValue?: any;
  187. }
  188. interface IGLTFTechniqueCommonProfile {
  189. lightingModel: string;
  190. texcoordBindings: Object;
  191. parameters?: Array<any>;
  192. }
  193. interface IGLTFTechniqueStatesFunctions {
  194. blendColor?: number[];
  195. blendEquationSeparate?: number[];
  196. blendFuncSeparate?: number[];
  197. colorMask: boolean[];
  198. cullFace: number[];
  199. }
  200. interface IGLTFTechniqueStates {
  201. enable: number[];
  202. functions: IGLTFTechniqueStatesFunctions;
  203. }
  204. interface IGLTFTechnique extends IGLTFChildRootProperty {
  205. parameters: {
  206. [key: string]: IGLTFTechniqueParameter;
  207. };
  208. program: string;
  209. attributes: {
  210. [key: string]: string;
  211. };
  212. uniforms: {
  213. [key: string]: string;
  214. };
  215. states: IGLTFTechniqueStates;
  216. }
  217. interface IGLTFMaterial extends IGLTFChildRootProperty {
  218. technique?: string;
  219. values: string[];
  220. }
  221. interface IGLTFMeshPrimitive extends IGLTFProperty {
  222. attributes: {
  223. [key: string]: string;
  224. };
  225. indices: string;
  226. material: string;
  227. mode?: number;
  228. }
  229. interface IGLTFMesh extends IGLTFChildRootProperty {
  230. primitives: IGLTFMeshPrimitive[];
  231. }
  232. interface IGLTFImage extends IGLTFChildRootProperty {
  233. uri: string;
  234. }
  235. interface IGLTFSampler extends IGLTFChildRootProperty {
  236. magFilter?: number;
  237. minFilter?: number;
  238. wrapS?: number;
  239. wrapT?: number;
  240. }
  241. interface IGLTFTexture extends IGLTFChildRootProperty {
  242. sampler: string;
  243. source: string;
  244. format?: ETextureFormat;
  245. internalFormat?: ETextureFormat;
  246. target?: number;
  247. type?: number;
  248. babylonTexture?: Texture;
  249. }
  250. interface IGLTFAmbienLight {
  251. color?: number[];
  252. }
  253. interface IGLTFDirectionalLight {
  254. color?: number[];
  255. }
  256. interface IGLTFPointLight {
  257. color?: number[];
  258. constantAttenuation?: number;
  259. linearAttenuation?: number;
  260. quadraticAttenuation?: number;
  261. }
  262. interface IGLTFSpotLight {
  263. color?: number[];
  264. constantAttenuation?: number;
  265. fallOfAngle?: number;
  266. fallOffExponent?: number;
  267. linearAttenuation?: number;
  268. quadraticAttenuation?: number;
  269. }
  270. interface IGLTFLight extends IGLTFChildRootProperty {
  271. type: string;
  272. }
  273. interface IGLTFCameraOrthographic {
  274. xmag: number;
  275. ymag: number;
  276. zfar: number;
  277. znear: number;
  278. }
  279. interface IGLTFCameraPerspective {
  280. aspectRatio: number;
  281. yfov: number;
  282. zfar: number;
  283. znear: number;
  284. }
  285. interface IGLTFCamera extends IGLTFChildRootProperty {
  286. type: string;
  287. }
  288. interface IGLTFAnimationChannelTarget {
  289. id: string;
  290. path: string;
  291. }
  292. interface IGLTFAnimationChannel {
  293. sampler: string;
  294. target: IGLTFAnimationChannelTarget;
  295. }
  296. interface IGLTFAnimationSampler {
  297. input: string;
  298. output: string;
  299. interpolation?: string;
  300. }
  301. interface IGLTFAnimation extends IGLTFChildRootProperty {
  302. channels?: IGLTFAnimationChannel[];
  303. parameters?: {
  304. [key: string]: string;
  305. };
  306. samplers?: {
  307. [key: string]: IGLTFAnimationSampler;
  308. };
  309. }
  310. interface IGLTFNodeInstanceSkin {
  311. skeletons: string[];
  312. skin: string;
  313. meshes: string[];
  314. }
  315. interface IGLTFSkins extends IGLTFChildRootProperty {
  316. bindShapeMatrix: number[];
  317. inverseBindMatrices: string;
  318. jointNames: string[];
  319. babylonSkeleton?: Skeleton;
  320. }
  321. interface IGLTFNode extends IGLTFChildRootProperty {
  322. camera?: string;
  323. children: string[];
  324. skin?: string;
  325. jointName?: string;
  326. light?: string;
  327. matrix: number[];
  328. mesh?: string;
  329. meshes?: string[];
  330. rotation?: number[];
  331. scale?: number[];
  332. translation?: number[];
  333. babylonNode?: Node;
  334. }
  335. interface IGLTFScene extends IGLTFChildRootProperty {
  336. nodes: string[];
  337. }
  338. /**
  339. * Runtime
  340. */
  341. interface IGLTFRuntime {
  342. extensions: {
  343. [key: string]: any;
  344. };
  345. accessors: {
  346. [key: string]: IGLTFAccessor;
  347. };
  348. buffers: {
  349. [key: string]: IGLTFBuffer;
  350. };
  351. bufferViews: {
  352. [key: string]: IGLTFBufferView;
  353. };
  354. meshes: {
  355. [key: string]: IGLTFMesh;
  356. };
  357. lights: {
  358. [key: string]: IGLTFLight;
  359. };
  360. cameras: {
  361. [key: string]: IGLTFCamera;
  362. };
  363. nodes: {
  364. [key: string]: IGLTFNode;
  365. };
  366. images: {
  367. [key: string]: IGLTFImage;
  368. };
  369. textures: {
  370. [key: string]: IGLTFTexture;
  371. };
  372. shaders: {
  373. [key: string]: IGLTFShader;
  374. };
  375. programs: {
  376. [key: string]: IGLTFProgram;
  377. };
  378. samplers: {
  379. [key: string]: IGLTFSampler;
  380. };
  381. techniques: {
  382. [key: string]: IGLTFTechnique;
  383. };
  384. materials: {
  385. [key: string]: IGLTFMaterial;
  386. };
  387. animations: {
  388. [key: string]: IGLTFAnimation;
  389. };
  390. skins: {
  391. [key: string]: IGLTFSkins;
  392. };
  393. currentScene?: Object;
  394. scenes: {
  395. [key: string]: IGLTFScene;
  396. };
  397. extensionsUsed: string[];
  398. extensionsRequired?: string[];
  399. buffersCount: number;
  400. shaderscount: number;
  401. scene: Scene;
  402. rootUrl: string;
  403. loadedBufferCount: number;
  404. loadedBufferViews: {
  405. [name: string]: ArrayBufferView;
  406. };
  407. loadedShaderCount: number;
  408. importOnlyMeshes: boolean;
  409. importMeshesNames?: string[];
  410. dummyNodes: Node[];
  411. }
  412. /**
  413. * Bones
  414. */
  415. interface INodeToRoot {
  416. bone: Bone;
  417. node: IGLTFNode;
  418. id: string;
  419. }
  420. interface IJointNode {
  421. node: IGLTFNode;
  422. id: string;
  423. }
  424. }
  425. declare module BABYLON.GLTF1 {
  426. /**
  427. * Implementation of the base glTF spec
  428. */
  429. class GLTFLoaderBase {
  430. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  431. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  432. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): void;
  433. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  434. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): void;
  435. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  436. }
  437. /**
  438. * glTF V1 Loader
  439. */
  440. class GLTFLoader implements IGLTFLoader {
  441. static Extensions: {
  442. [name: string]: GLTFLoaderExtension;
  443. };
  444. static RegisterExtension(extension: GLTFLoaderExtension): void;
  445. 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;
  446. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void): void;
  447. private _loadShadersAsync(gltfRuntime, onload);
  448. private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?);
  449. private _createNodes(gltfRuntime);
  450. }
  451. }
  452. declare module BABYLON.GLTF1 {
  453. /**
  454. * Utils functions for GLTF
  455. */
  456. class GLTFUtils {
  457. /**
  458. * Sets the given "parameter" matrix
  459. * @param scene: the {BABYLON.Scene} object
  460. * @param source: the source node where to pick the matrix
  461. * @param parameter: the GLTF technique parameter
  462. * @param uniformName: the name of the shader's uniform
  463. * @param shaderMaterial: the shader material
  464. */
  465. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  466. /**
  467. * Sets the given "parameter" matrix
  468. * @param shaderMaterial: the shader material
  469. * @param uniform: the name of the shader's uniform
  470. * @param value: the value of the uniform
  471. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  472. */
  473. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  474. /**
  475. * If the uri is a base64 string
  476. * @param uri: the uri to test
  477. */
  478. static IsBase64(uri: string): boolean;
  479. /**
  480. * Decode the base64 uri
  481. * @param uri: the uri to decode
  482. */
  483. static DecodeBase64(uri: string): ArrayBuffer;
  484. /**
  485. * Returns the wrap mode of the texture
  486. * @param mode: the mode value
  487. */
  488. static GetWrapMode(mode: number): number;
  489. /**
  490. * Returns the byte stride giving an accessor
  491. * @param accessor: the GLTF accessor objet
  492. */
  493. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  494. /**
  495. * Returns the texture filter mode giving a mode value
  496. * @param mode: the filter mode value
  497. */
  498. static GetTextureFilterMode(mode: number): ETextureFilterType;
  499. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  500. /**
  501. * Returns a buffer from its accessor
  502. * @param gltfRuntime: the GLTF runtime
  503. * @param accessor: the GLTF accessor
  504. */
  505. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  506. /**
  507. * Decodes a buffer view into a string
  508. * @param view: the buffer view
  509. */
  510. static DecodeBufferToText(view: ArrayBufferView): string;
  511. /**
  512. * Returns the default material of gltf. Related to
  513. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  514. * @param scene: the Babylon.js scene
  515. */
  516. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  517. private static _DefaultMaterial;
  518. }
  519. }
  520. declare module BABYLON.GLTF1 {
  521. abstract class GLTFLoaderExtension {
  522. private _name;
  523. constructor(name: string);
  524. readonly name: string;
  525. /**
  526. * Defines an override for loading the runtime
  527. * Return true to stop further extensions from loading the runtime
  528. */
  529. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  530. /**
  531. * Defines an onverride for creating gltf runtime
  532. * Return true to stop further extensions from creating the runtime
  533. */
  534. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  535. /**
  536. * Defines an override for loading buffers
  537. * Return true to stop further extensions from loading this buffer
  538. */
  539. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  540. /**
  541. * Defines an override for loading texture buffers
  542. * Return true to stop further extensions from loading this texture data
  543. */
  544. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  545. /**
  546. * Defines an override for creating textures
  547. * Return true to stop further extensions from loading this texture
  548. */
  549. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  550. /**
  551. * Defines an override for loading shader strings
  552. * Return true to stop further extensions from loading this shader data
  553. */
  554. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  555. /**
  556. * Defines an override for loading materials
  557. * Return true to stop further extensions from loading this material
  558. */
  559. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  560. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): void;
  561. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): void;
  562. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  563. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  564. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string) => void, onError: (message: string) => void): void;
  565. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  566. private static LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);
  567. private static CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
  568. private static ApplyExtensions(func, defaultFunc);
  569. }
  570. }
  571. declare module BABYLON.GLTF1 {
  572. class GLTFBinaryExtension extends GLTFLoaderExtension {
  573. private _bin;
  574. constructor();
  575. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  576. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  577. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  578. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  579. }
  580. }
  581. declare module BABYLON.GLTF1 {
  582. class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  583. constructor();
  584. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  585. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  586. private _loadTexture(gltfRuntime, id, material, propertyPath, onError);
  587. }
  588. }