glTFLoaderInterfaces.d.ts 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. import type { AssetContainer } from "@babylonjs/core/assetContainer.js";
  2. import type { Bone } from "@babylonjs/core/Bones/bone.js";
  3. import type { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
  4. import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
  5. import type { Node } from "@babylonjs/core/node.js";
  6. import type { Scene } from "@babylonjs/core/scene.js";
  7. import type { Nullable } from "@babylonjs/core/types.js";
  8. /**
  9. * Enums
  10. * @internal
  11. */
  12. export declare enum EComponentType {
  13. BYTE = 5120,
  14. UNSIGNED_BYTE = 5121,
  15. SHORT = 5122,
  16. UNSIGNED_SHORT = 5123,
  17. FLOAT = 5126
  18. }
  19. /** @internal */
  20. export declare enum EShaderType {
  21. FRAGMENT = 35632,
  22. VERTEX = 35633
  23. }
  24. /** @internal */
  25. export declare enum EParameterType {
  26. BYTE = 5120,
  27. UNSIGNED_BYTE = 5121,
  28. SHORT = 5122,
  29. UNSIGNED_SHORT = 5123,
  30. INT = 5124,
  31. UNSIGNED_INT = 5125,
  32. FLOAT = 5126,
  33. FLOAT_VEC2 = 35664,
  34. FLOAT_VEC3 = 35665,
  35. FLOAT_VEC4 = 35666,
  36. INT_VEC2 = 35667,
  37. INT_VEC3 = 35668,
  38. INT_VEC4 = 35669,
  39. BOOL = 35670,
  40. BOOL_VEC2 = 35671,
  41. BOOL_VEC3 = 35672,
  42. BOOL_VEC4 = 35673,
  43. FLOAT_MAT2 = 35674,
  44. FLOAT_MAT3 = 35675,
  45. FLOAT_MAT4 = 35676,
  46. SAMPLER_2D = 35678
  47. }
  48. /** @internal */
  49. export declare enum ETextureWrapMode {
  50. CLAMP_TO_EDGE = 33071,
  51. MIRRORED_REPEAT = 33648,
  52. REPEAT = 10497
  53. }
  54. /** @internal */
  55. export declare enum ETextureFilterType {
  56. NEAREST = 9728,
  57. LINEAR = 9728,
  58. NEAREST_MIPMAP_NEAREST = 9984,
  59. LINEAR_MIPMAP_NEAREST = 9985,
  60. NEAREST_MIPMAP_LINEAR = 9986,
  61. LINEAR_MIPMAP_LINEAR = 9987
  62. }
  63. /** @internal */
  64. export declare enum ETextureFormat {
  65. ALPHA = 6406,
  66. RGB = 6407,
  67. RGBA = 6408,
  68. LUMINANCE = 6409,
  69. LUMINANCE_ALPHA = 6410
  70. }
  71. /** @internal */
  72. export declare enum ECullingType {
  73. FRONT = 1028,
  74. BACK = 1029,
  75. FRONT_AND_BACK = 1032
  76. }
  77. /** @internal */
  78. export declare enum EBlendingFunction {
  79. ZERO = 0,
  80. ONE = 1,
  81. SRC_COLOR = 768,
  82. ONE_MINUS_SRC_COLOR = 769,
  83. DST_COLOR = 774,
  84. ONE_MINUS_DST_COLOR = 775,
  85. SRC_ALPHA = 770,
  86. ONE_MINUS_SRC_ALPHA = 771,
  87. DST_ALPHA = 772,
  88. ONE_MINUS_DST_ALPHA = 773,
  89. CONSTANT_COLOR = 32769,
  90. ONE_MINUS_CONSTANT_COLOR = 32770,
  91. CONSTANT_ALPHA = 32771,
  92. ONE_MINUS_CONSTANT_ALPHA = 32772,
  93. SRC_ALPHA_SATURATE = 776
  94. }
  95. /** @internal */
  96. export interface IGLTFProperty {
  97. extensions?: {
  98. [key: string]: any;
  99. };
  100. extras?: Object;
  101. }
  102. /** @internal */
  103. export interface IGLTFChildRootProperty extends IGLTFProperty {
  104. name?: string;
  105. }
  106. /** @internal */
  107. export interface IGLTFAccessor extends IGLTFChildRootProperty {
  108. bufferView: string;
  109. byteOffset: number;
  110. byteStride: number;
  111. count: number;
  112. type: string;
  113. componentType: EComponentType;
  114. max?: number[];
  115. min?: number[];
  116. name?: string;
  117. }
  118. /** @internal */
  119. export interface IGLTFBufferView extends IGLTFChildRootProperty {
  120. buffer: string;
  121. byteOffset: number;
  122. byteLength: number;
  123. byteStride: number;
  124. target?: number;
  125. }
  126. /** @internal */
  127. export interface IGLTFBuffer extends IGLTFChildRootProperty {
  128. uri: string;
  129. byteLength?: number;
  130. type?: string;
  131. }
  132. /** @internal */
  133. export interface IGLTFShader extends IGLTFChildRootProperty {
  134. uri: string;
  135. type: EShaderType;
  136. }
  137. /** @internal */
  138. export interface IGLTFProgram extends IGLTFChildRootProperty {
  139. attributes: string[];
  140. fragmentShader: string;
  141. vertexShader: string;
  142. }
  143. /** @internal */
  144. export interface IGLTFTechniqueParameter {
  145. type: number;
  146. count?: number;
  147. semantic?: string;
  148. node?: string;
  149. value?: number | boolean | string | Array<any>;
  150. source?: string;
  151. babylonValue?: any;
  152. }
  153. /** @internal */
  154. export interface IGLTFTechniqueCommonProfile {
  155. lightingModel: string;
  156. texcoordBindings: Object;
  157. parameters?: Array<any>;
  158. }
  159. /** @internal */
  160. export interface IGLTFTechniqueStatesFunctions {
  161. blendColor?: number[];
  162. blendEquationSeparate?: number[];
  163. blendFuncSeparate?: number[];
  164. colorMask: boolean[];
  165. cullFace: number[];
  166. }
  167. /** @internal */
  168. export interface IGLTFTechniqueStates {
  169. enable: number[];
  170. functions: IGLTFTechniqueStatesFunctions;
  171. }
  172. /** @internal */
  173. export interface IGLTFTechnique extends IGLTFChildRootProperty {
  174. parameters: {
  175. [key: string]: IGLTFTechniqueParameter;
  176. };
  177. program: string;
  178. attributes: {
  179. [key: string]: string;
  180. };
  181. uniforms: {
  182. [key: string]: string;
  183. };
  184. states: IGLTFTechniqueStates;
  185. }
  186. /** @internal */
  187. export interface IGLTFMaterial extends IGLTFChildRootProperty {
  188. technique?: string;
  189. values: string[];
  190. }
  191. /** @internal */
  192. export interface IGLTFMeshPrimitive extends IGLTFProperty {
  193. attributes: {
  194. [key: string]: string;
  195. };
  196. indices: string;
  197. material: string;
  198. mode?: number;
  199. }
  200. /** @internal */
  201. export interface IGLTFMesh extends IGLTFChildRootProperty {
  202. primitives: IGLTFMeshPrimitive[];
  203. }
  204. /** @internal */
  205. export interface IGLTFImage extends IGLTFChildRootProperty {
  206. uri: string;
  207. }
  208. /** @internal */
  209. export interface IGLTFSampler extends IGLTFChildRootProperty {
  210. magFilter?: number;
  211. minFilter?: number;
  212. wrapS?: number;
  213. wrapT?: number;
  214. }
  215. /** @internal */
  216. export interface IGLTFTexture extends IGLTFChildRootProperty {
  217. sampler: string;
  218. source: string;
  219. format?: ETextureFormat;
  220. internalFormat?: ETextureFormat;
  221. target?: number;
  222. type?: number;
  223. babylonTexture?: Texture;
  224. }
  225. /** @internal */
  226. export interface IGLTFAmbienLight {
  227. color?: number[];
  228. }
  229. /** @internal */
  230. export interface IGLTFDirectionalLight {
  231. color?: number[];
  232. }
  233. /** @internal */
  234. export interface IGLTFPointLight {
  235. color?: number[];
  236. constantAttenuation?: number;
  237. linearAttenuation?: number;
  238. quadraticAttenuation?: number;
  239. }
  240. /** @internal */
  241. export interface IGLTFSpotLight {
  242. color?: number[];
  243. constantAttenuation?: number;
  244. fallOfAngle?: number;
  245. fallOffExponent?: number;
  246. linearAttenuation?: number;
  247. quadraticAttenuation?: number;
  248. }
  249. /** @internal */
  250. export interface IGLTFLight extends IGLTFChildRootProperty {
  251. type: string;
  252. }
  253. /** @internal */
  254. export interface IGLTFCameraOrthographic {
  255. xmag: number;
  256. ymag: number;
  257. zfar: number;
  258. znear: number;
  259. }
  260. /** @internal */
  261. export interface IGLTFCameraPerspective {
  262. aspectRatio: number;
  263. yfov: number;
  264. zfar: number;
  265. znear: number;
  266. }
  267. /** @internal */
  268. export interface IGLTFCamera extends IGLTFChildRootProperty {
  269. type: string;
  270. }
  271. /** @internal */
  272. export interface IGLTFAnimationChannelTarget {
  273. id: string;
  274. path: string;
  275. }
  276. /** @internal */
  277. export interface IGLTFAnimationChannel {
  278. sampler: string;
  279. target: IGLTFAnimationChannelTarget;
  280. }
  281. /** @internal */
  282. export interface IGLTFAnimationSampler {
  283. input: string;
  284. output: string;
  285. interpolation?: string;
  286. }
  287. /** @internal */
  288. export interface IGLTFAnimation extends IGLTFChildRootProperty {
  289. channels?: IGLTFAnimationChannel[];
  290. parameters?: {
  291. [key: string]: string;
  292. };
  293. samplers?: {
  294. [key: string]: IGLTFAnimationSampler;
  295. };
  296. }
  297. /** @internal */
  298. export interface IGLTFNodeInstanceSkin {
  299. skeletons: string[];
  300. skin: string;
  301. meshes: string[];
  302. }
  303. /** @internal */
  304. export interface IGLTFSkins extends IGLTFChildRootProperty {
  305. bindShapeMatrix: number[];
  306. inverseBindMatrices: string;
  307. jointNames: string[];
  308. babylonSkeleton?: Skeleton;
  309. }
  310. /** @internal */
  311. export interface IGLTFNode extends IGLTFChildRootProperty {
  312. camera?: string;
  313. children: string[];
  314. skin?: string;
  315. jointName?: string;
  316. light?: string;
  317. matrix: number[];
  318. mesh?: string;
  319. meshes?: string[];
  320. rotation?: number[];
  321. scale?: number[];
  322. translation?: number[];
  323. babylonNode?: Node;
  324. }
  325. /** @internal */
  326. export interface IGLTFScene extends IGLTFChildRootProperty {
  327. nodes: string[];
  328. }
  329. /** @internal */
  330. export interface IGLTFRuntime {
  331. extensions: {
  332. [key: string]: any;
  333. };
  334. accessors: {
  335. [key: string]: IGLTFAccessor;
  336. };
  337. buffers: {
  338. [key: string]: IGLTFBuffer;
  339. };
  340. bufferViews: {
  341. [key: string]: IGLTFBufferView;
  342. };
  343. meshes: {
  344. [key: string]: IGLTFMesh;
  345. };
  346. lights: {
  347. [key: string]: IGLTFLight;
  348. };
  349. cameras: {
  350. [key: string]: IGLTFCamera;
  351. };
  352. nodes: {
  353. [key: string]: IGLTFNode;
  354. };
  355. images: {
  356. [key: string]: IGLTFImage;
  357. };
  358. textures: {
  359. [key: string]: IGLTFTexture;
  360. };
  361. shaders: {
  362. [key: string]: IGLTFShader;
  363. };
  364. programs: {
  365. [key: string]: IGLTFProgram;
  366. };
  367. samplers: {
  368. [key: string]: IGLTFSampler;
  369. };
  370. techniques: {
  371. [key: string]: IGLTFTechnique;
  372. };
  373. materials: {
  374. [key: string]: IGLTFMaterial;
  375. };
  376. animations: {
  377. [key: string]: IGLTFAnimation;
  378. };
  379. skins: {
  380. [key: string]: IGLTFSkins;
  381. };
  382. currentScene?: Object;
  383. scenes: {
  384. [key: string]: IGLTFScene;
  385. };
  386. extensionsUsed: string[];
  387. extensionsRequired?: string[];
  388. buffersCount: number;
  389. shaderscount: number;
  390. scene: Scene;
  391. rootUrl: string;
  392. loadedBufferCount: number;
  393. loadedBufferViews: {
  394. [name: string]: ArrayBufferView;
  395. };
  396. loadedShaderCount: number;
  397. importOnlyMeshes: boolean;
  398. importMeshesNames?: string[];
  399. dummyNodes: Node[];
  400. assetContainer: Nullable<AssetContainer>;
  401. }
  402. /** @internal */
  403. export interface INodeToRoot {
  404. bone: Bone;
  405. node: IGLTFNode;
  406. id: string;
  407. }
  408. /** @internal */
  409. export interface IJointNode {
  410. node: IGLTFNode;
  411. id: string;
  412. }