babylon.glTFFileLoader.d.ts 43 KB

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