babylon.glTF1FileLoader.d.ts 22 KB

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