babylon.glTF1FileLoader.d.ts 22 KB

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