babylon.glTF2FileLoader.d.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. declare module BABYLON {
  2. enum GLTFLoaderCoordinateSystemMode {
  3. /**
  4. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  5. */
  6. AUTO = 0,
  7. /**
  8. * Sets the useRightHandedSystem flag on the scene.
  9. */
  10. FORCE_RIGHT_HANDED = 1,
  11. }
  12. enum GLTFLoaderAnimationStartMode {
  13. /**
  14. * No animation will start.
  15. */
  16. NONE = 0,
  17. /**
  18. * The first animation will start.
  19. */
  20. FIRST = 1,
  21. /**
  22. * All animations will start.
  23. */
  24. ALL = 2,
  25. }
  26. interface IGLTFLoaderData {
  27. json: Object;
  28. bin: Nullable<ArrayBufferView>;
  29. }
  30. interface IGLTFLoader extends IDisposable {
  31. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  32. animationStartMode: GLTFLoaderAnimationStartMode;
  33. compileMaterials: boolean;
  34. useClipPlane: boolean;
  35. compileShadowGenerators: boolean;
  36. onDisposeObservable: Observable<IGLTFLoader>;
  37. onMeshLoadedObservable: Observable<AbstractMesh>;
  38. onTextureLoadedObservable: Observable<BaseTexture>;
  39. onMaterialLoadedObservable: Observable<Material>;
  40. onCompleteObservable: Observable<IGLTFLoader>;
  41. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void;
  42. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void;
  43. }
  44. class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  45. static CreateGLTFLoaderV1: () => IGLTFLoader;
  46. static CreateGLTFLoaderV2: () => IGLTFLoader;
  47. /**
  48. * Raised when the asset has been parsed.
  49. * The data.json property stores the glTF JSON.
  50. * The data.bin property stores the BIN chunk from a glTF binary or null if the input is not a glTF binary.
  51. */
  52. onParsedObservable: Observable<IGLTFLoaderData>;
  53. private _onParsedObserver;
  54. onParsed: (loaderData: IGLTFLoaderData) => void;
  55. static IncrementalLoading: boolean;
  56. static HomogeneousCoordinates: boolean;
  57. /**
  58. * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
  59. */
  60. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  61. /**
  62. * The animation start mode (NONE, FIRST, ALL).
  63. */
  64. animationStartMode: GLTFLoaderAnimationStartMode;
  65. /**
  66. * Set to true to compile materials before raising the success callback.
  67. */
  68. compileMaterials: boolean;
  69. /**
  70. * Set to true to also compile materials with clip planes.
  71. */
  72. useClipPlane: boolean;
  73. /**
  74. * Set to true to compile shadow generators before raising the success callback.
  75. */
  76. compileShadowGenerators: boolean;
  77. /**
  78. * Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  79. */
  80. onMeshLoadedObservable: Observable<AbstractMesh>;
  81. private _onMeshLoadedObserver;
  82. onMeshLoaded: (mesh: AbstractMesh) => void;
  83. /**
  84. * Raised when the loader creates a texture after parsing the glTF properties of the texture.
  85. */
  86. onTextureLoadedObservable: Observable<BaseTexture>;
  87. private _onTextureLoadedObserver;
  88. onTextureLoaded: (Texture: BaseTexture) => void;
  89. /**
  90. * Raised when the loader creates a material after parsing the glTF properties of the material.
  91. */
  92. onMaterialLoadedObservable: Observable<Material>;
  93. private _onMaterialLoadedObserver;
  94. onMaterialLoaded: (Material: Material) => void;
  95. /**
  96. * Raised when the asset is completely loaded, immediately before the loader is disposed.
  97. * For assets with LODs, raised when all of the LODs are complete.
  98. * For assets without LODs, raised when the model is complete, immediately after onSuccess.
  99. */
  100. onCompleteObservable: Observable<GLTFFileLoader>;
  101. private _onCompleteObserver;
  102. onComplete: () => void;
  103. /**
  104. * Raised when the loader is disposed.
  105. */
  106. onDisposeObservable: Observable<GLTFFileLoader>;
  107. private _onDisposeObserver;
  108. onDispose: () => void;
  109. private _loader;
  110. name: string;
  111. extensions: ISceneLoaderPluginExtensions;
  112. /**
  113. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  114. */
  115. dispose(): void;
  116. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
  117. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
  118. loadAssetsAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: (assets: AssetContainer) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
  119. canDirectLoad(data: string): boolean;
  120. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  121. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  122. private _parse(data);
  123. private _getLoader(loaderData);
  124. private static _parseBinary(data);
  125. private static _parseV1(binaryReader);
  126. private static _parseV2(binaryReader);
  127. private static _parseVersion(version);
  128. private static _compareVersion(a, b);
  129. private static _decodeBufferToText(buffer);
  130. }
  131. }
  132. declare module BABYLON.GLTF2 {
  133. /**
  134. * Enums
  135. */
  136. enum EComponentType {
  137. BYTE = 5120,
  138. UNSIGNED_BYTE = 5121,
  139. SHORT = 5122,
  140. UNSIGNED_SHORT = 5123,
  141. UNSIGNED_INT = 5125,
  142. FLOAT = 5126,
  143. }
  144. enum EMeshPrimitiveMode {
  145. POINTS = 0,
  146. LINES = 1,
  147. LINE_LOOP = 2,
  148. LINE_STRIP = 3,
  149. TRIANGLES = 4,
  150. TRIANGLE_STRIP = 5,
  151. TRIANGLE_FAN = 6,
  152. }
  153. enum ETextureMagFilter {
  154. NEAREST = 9728,
  155. LINEAR = 9729,
  156. }
  157. enum ETextureMinFilter {
  158. NEAREST = 9728,
  159. LINEAR = 9729,
  160. NEAREST_MIPMAP_NEAREST = 9984,
  161. LINEAR_MIPMAP_NEAREST = 9985,
  162. NEAREST_MIPMAP_LINEAR = 9986,
  163. LINEAR_MIPMAP_LINEAR = 9987,
  164. }
  165. enum ETextureWrapMode {
  166. CLAMP_TO_EDGE = 33071,
  167. MIRRORED_REPEAT = 33648,
  168. REPEAT = 10497,
  169. }
  170. /**
  171. * Interfaces
  172. */
  173. interface IGLTFProperty {
  174. extensions?: {
  175. [key: string]: any;
  176. };
  177. extras?: any;
  178. }
  179. interface IGLTFChildRootProperty extends IGLTFProperty {
  180. name?: string;
  181. }
  182. interface IGLTFAccessorSparseIndices extends IGLTFProperty {
  183. bufferView: number;
  184. byteOffset?: number;
  185. componentType: EComponentType;
  186. }
  187. interface IGLTFAccessorSparseValues extends IGLTFProperty {
  188. bufferView: number;
  189. byteOffset?: number;
  190. }
  191. interface IGLTFAccessorSparse extends IGLTFProperty {
  192. count: number;
  193. indices: IGLTFAccessorSparseIndices;
  194. values: IGLTFAccessorSparseValues;
  195. }
  196. interface IGLTFAccessor extends IGLTFChildRootProperty {
  197. bufferView?: number;
  198. byteOffset?: number;
  199. componentType: EComponentType;
  200. normalized?: boolean;
  201. count: number;
  202. type: string;
  203. max: number[];
  204. min: number[];
  205. sparse?: IGLTFAccessorSparse;
  206. index: number;
  207. }
  208. interface IGLTFAnimationChannel extends IGLTFProperty {
  209. sampler: number;
  210. target: IGLTFAnimationChannelTarget;
  211. }
  212. interface IGLTFAnimationChannelTarget extends IGLTFProperty {
  213. node: number;
  214. path: string;
  215. }
  216. interface IGLTFAnimationSampler extends IGLTFProperty {
  217. input: number;
  218. interpolation?: string;
  219. output: number;
  220. }
  221. interface IGLTFAnimation extends IGLTFChildRootProperty {
  222. channels: IGLTFAnimationChannel[];
  223. samplers: IGLTFAnimationSampler[];
  224. index: number;
  225. babylonAnimationGroup: AnimationGroup;
  226. }
  227. interface IGLTFAsset extends IGLTFChildRootProperty {
  228. copyright?: string;
  229. generator?: string;
  230. version: string;
  231. minVersion?: string;
  232. }
  233. interface IGLTFBuffer extends IGLTFChildRootProperty {
  234. uri?: string;
  235. byteLength: number;
  236. index: number;
  237. loadedData?: ArrayBufferView;
  238. loadedObservable?: Observable<IGLTFBuffer>;
  239. }
  240. interface IGLTFBufferView extends IGLTFChildRootProperty {
  241. buffer: number;
  242. byteOffset?: number;
  243. byteLength: number;
  244. byteStride?: number;
  245. index: number;
  246. }
  247. interface IGLTFCameraOrthographic extends IGLTFProperty {
  248. xmag: number;
  249. ymag: number;
  250. zfar: number;
  251. znear: number;
  252. }
  253. interface IGLTFCameraPerspective extends IGLTFProperty {
  254. aspectRatio: number;
  255. yfov: number;
  256. zfar: number;
  257. znear: number;
  258. }
  259. interface IGLTFCamera extends IGLTFChildRootProperty {
  260. orthographic?: IGLTFCameraOrthographic;
  261. perspective?: IGLTFCameraPerspective;
  262. type: string;
  263. }
  264. interface IGLTFImage extends IGLTFChildRootProperty {
  265. uri?: string;
  266. mimeType?: string;
  267. bufferView?: number;
  268. index: number;
  269. }
  270. interface IGLTFMaterialNormalTextureInfo extends IGLTFTextureInfo {
  271. scale: number;
  272. }
  273. interface IGLTFMaterialOcclusionTextureInfo extends IGLTFTextureInfo {
  274. strength: number;
  275. }
  276. interface IGLTFMaterialPbrMetallicRoughness {
  277. baseColorFactor: number[];
  278. baseColorTexture: IGLTFTextureInfo;
  279. metallicFactor: number;
  280. roughnessFactor: number;
  281. metallicRoughnessTexture: IGLTFTextureInfo;
  282. }
  283. interface IGLTFMaterial extends IGLTFChildRootProperty {
  284. pbrMetallicRoughness?: IGLTFMaterialPbrMetallicRoughness;
  285. normalTexture?: IGLTFMaterialNormalTextureInfo;
  286. occlusionTexture?: IGLTFMaterialOcclusionTextureInfo;
  287. emissiveTexture?: IGLTFTextureInfo;
  288. emissiveFactor?: number[];
  289. alphaMode?: string;
  290. alphaCutoff: number;
  291. doubleSided?: boolean;
  292. index: number;
  293. babylonMaterial: Material;
  294. }
  295. interface IGLTFMeshPrimitive extends IGLTFProperty {
  296. attributes: {
  297. [name: string]: number;
  298. };
  299. indices?: number;
  300. material?: number;
  301. mode?: EMeshPrimitiveMode;
  302. targets?: {
  303. [name: string]: number;
  304. }[];
  305. vertexData: VertexData;
  306. targetsVertexData: VertexData[];
  307. }
  308. interface IGLTFMesh extends IGLTFChildRootProperty {
  309. primitives: IGLTFMeshPrimitive[];
  310. weights?: number[];
  311. index: number;
  312. hasVertexAlpha: boolean;
  313. }
  314. interface IGLTFNode extends IGLTFChildRootProperty {
  315. camera?: number;
  316. children?: number[];
  317. skin?: number;
  318. matrix?: number[];
  319. mesh?: number;
  320. rotation?: number[];
  321. scale?: number[];
  322. translation?: number[];
  323. weights?: number[];
  324. index: number;
  325. parent: IGLTFNode;
  326. babylonMesh: Mesh;
  327. babylonAnimationTargets?: Node[];
  328. }
  329. interface IGLTFSampler extends IGLTFChildRootProperty {
  330. magFilter?: ETextureMagFilter;
  331. minFilter?: ETextureMinFilter;
  332. wrapS?: ETextureWrapMode;
  333. wrapT?: ETextureWrapMode;
  334. index: number;
  335. noMipMaps: boolean;
  336. samplingMode: number;
  337. wrapU: number;
  338. wrapV: number;
  339. }
  340. interface IGLTFScene extends IGLTFChildRootProperty {
  341. nodes: number[];
  342. index: number;
  343. }
  344. interface IGLTFSkin extends IGLTFChildRootProperty {
  345. inverseBindMatrices?: number;
  346. skeleton?: number;
  347. joints: number[];
  348. index: number;
  349. babylonSkeleton: Skeleton;
  350. }
  351. interface IGLTFTexture extends IGLTFChildRootProperty {
  352. sampler?: number;
  353. source: number;
  354. index: number;
  355. url?: string;
  356. dataReadyObservable?: Observable<IGLTFTexture>;
  357. }
  358. interface IGLTFTextureInfo {
  359. index: number;
  360. texCoord?: number;
  361. }
  362. interface IGLTF extends IGLTFProperty {
  363. accessors?: IGLTFAccessor[];
  364. animations?: IGLTFAnimation[];
  365. asset: IGLTFAsset;
  366. buffers?: IGLTFBuffer[];
  367. bufferViews?: IGLTFBufferView[];
  368. cameras?: IGLTFCamera[];
  369. extensionsUsed?: string[];
  370. extensionsRequired?: string[];
  371. images?: IGLTFImage[];
  372. materials?: IGLTFMaterial[];
  373. meshes?: IGLTFMesh[];
  374. nodes?: IGLTFNode[];
  375. samplers?: IGLTFSampler[];
  376. scene?: number;
  377. scenes?: IGLTFScene[];
  378. skins?: IGLTFSkin[];
  379. textures?: IGLTFTexture[];
  380. }
  381. }
  382. declare module BABYLON.GLTF2 {
  383. class GLTFLoader implements IGLTFLoader {
  384. _gltf: IGLTF;
  385. _babylonScene: Scene;
  386. private _disposed;
  387. private _rootUrl;
  388. private _defaultMaterial;
  389. private _defaultSampler;
  390. private _rootNode;
  391. private _successCallback?;
  392. private _progressCallback?;
  393. private _errorCallback?;
  394. private _renderReady;
  395. private _requests;
  396. private _renderReadyObservable;
  397. private _renderPendingCount;
  398. private _loaderPendingCount;
  399. private _loaderTrackers;
  400. static Extensions: {
  401. [name: string]: GLTFLoaderExtension;
  402. };
  403. static RegisterExtension(extension: GLTFLoaderExtension): void;
  404. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  405. animationStartMode: GLTFLoaderAnimationStartMode;
  406. compileMaterials: boolean;
  407. useClipPlane: boolean;
  408. compileShadowGenerators: boolean;
  409. onDisposeObservable: Observable<IGLTFLoader>;
  410. onMeshLoadedObservable: Observable<AbstractMesh>;
  411. onTextureLoadedObservable: Observable<BaseTexture>;
  412. onMaterialLoadedObservable: Observable<Material>;
  413. onCompleteObservable: Observable<IGLTFLoader>;
  414. dispose(): void;
  415. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
  416. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
  417. private _loadAsync(nodeNames, scene, data, rootUrl, onSuccess?, onProgress?, onError?);
  418. private _onProgress();
  419. _executeWhenRenderReady(func: () => void): void;
  420. private _onRenderReady();
  421. private _onComplete();
  422. private _loadData(data);
  423. private _getMeshes();
  424. private _getSkeletons();
  425. private _startAnimations();
  426. private _loadDefaultScene(nodeNames);
  427. private _loadScene(context, scene, nodeNames);
  428. _loadNode(context: string, node: IGLTFNode): void;
  429. private _loadMesh(context, node, mesh);
  430. private _loadAllVertexDataAsync(context, mesh, onSuccess);
  431. /**
  432. * Converts a data bufferview into a Float4 Texture Coordinate Array, based on the accessor component type
  433. * @param {ArrayBufferView} data
  434. * @param {IGLTFAccessor} accessor
  435. */
  436. private _convertToFloat4TextureCoordArray(context, data, accessor);
  437. /**
  438. * Converts a data bufferview into a Float4 Color Array, based on the accessor component type
  439. * @param {ArrayBufferView} data
  440. * @param {IGLTFAccessor} accessor
  441. */
  442. private _convertToFloat4ColorArray(context, data, accessor);
  443. private _loadVertexDataAsync(context, mesh, primitive, onSuccess);
  444. private _createMorphTargets(context, node, mesh);
  445. private _loadMorphTargets(context, node, mesh);
  446. private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
  447. private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
  448. private _loadTransform(node);
  449. private _loadSkinAsync(context, skin, onSuccess);
  450. private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
  451. private _loadBones(context, skin, inverseBindMatrixData);
  452. private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
  453. private _getNodeMatrix(node);
  454. private _traverseNodes(context, indices, action, parentNode);
  455. _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void;
  456. private _loadAnimations();
  457. private _loadAnimation(context, animation);
  458. private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
  459. private _loadBufferAsync(context, buffer, onSuccess);
  460. private _loadBufferViewAsync(context, bufferView, onSuccess);
  461. private _loadAccessorAsync(context, accessor, onSuccess);
  462. private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
  463. _addPendingData(data: any): void;
  464. _removePendingData(data: any): void;
  465. _addLoaderPendingData(data: any): void;
  466. _removeLoaderPendingData(data: any): void;
  467. _whenAction(action: () => void, onComplete: () => void): void;
  468. private _getDefaultMaterial();
  469. private _loadMaterialMetallicRoughnessProperties(context, material);
  470. _loadMaterial(context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): void;
  471. _createPbrMaterial(material: IGLTFMaterial): void;
  472. _loadMaterialBaseProperties(context: string, material: IGLTFMaterial): void;
  473. _loadMaterialAlphaProperties(context: string, material: IGLTFMaterial, colorFactor: number[]): void;
  474. _loadTexture(context: string, texture: IGLTFTexture, coordinatesIndex?: number): Texture;
  475. private _loadSampler(context, sampler);
  476. private _loadImageAsync(context, image, onSuccess);
  477. _loadUriAsync(context: string, uri: string, onSuccess: (data: ArrayBufferView) => void): void;
  478. _tryCatchOnError(handler: () => void): void;
  479. private static _AssignIndices(array?);
  480. static _GetProperty<T extends IGLTFProperty>(array?: ArrayLike<T>, index?: number): Nullable<T>;
  481. private static _GetTextureWrapMode(context, mode?);
  482. private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
  483. private static _GetNumComponents(context, type);
  484. private _compileMaterialAsync(babylonMaterial, babylonMesh, onSuccess);
  485. private _compileMaterialsAsync(onSuccess);
  486. private _compileShadowGeneratorsAsync(onSuccess);
  487. private _abortRequests();
  488. private _releaseResources();
  489. }
  490. }
  491. declare module BABYLON.GLTF2 {
  492. /**
  493. * Utils functions for GLTF
  494. */
  495. class GLTFUtils {
  496. /**
  497. * If the uri is a base64 string
  498. * @param uri: the uri to test
  499. */
  500. static IsBase64(uri: string): boolean;
  501. /**
  502. * Decode the base64 uri
  503. * @param uri: the uri to decode
  504. */
  505. static DecodeBase64(uri: string): ArrayBuffer;
  506. static ValidateUri(uri: string): boolean;
  507. }
  508. }
  509. declare module BABYLON.GLTF2 {
  510. abstract class GLTFLoaderExtension {
  511. enabled: boolean;
  512. readonly abstract name: string;
  513. protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
  514. protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
  515. protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  516. protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
  517. static _Extensions: GLTFLoaderExtension[];
  518. static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
  519. static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
  520. static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  521. private static _ApplyExtensions(action);
  522. }
  523. }
  524. declare module BABYLON.GLTF2.Extensions {
  525. class MSFTLOD extends GLTFLoaderExtension {
  526. /**
  527. * Specify the minimal delay between LODs in ms (default = 250)
  528. */
  529. Delay: number;
  530. readonly name: string;
  531. protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
  532. protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
  533. private _loadNodeLOD(loader, context, nodes, index, onComplete);
  534. protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  535. private _loadMaterialLOD(loader, context, materials, index, assign, onComplete);
  536. }
  537. }
  538. declare module BABYLON.GLTF2.Extensions {
  539. class KHRMaterialsPbrSpecularGlossiness extends GLTFLoaderExtension {
  540. readonly name: string;
  541. protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
  542. private _loadSpecularGlossinessProperties(loader, context, material, properties);
  543. }
  544. }