babylon.glTFFileLoaderInterfaces.ts 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. module BABYLON {
  2. /**
  3. * Interfaces
  4. */
  5. export interface IGLTFChildRootProperty {
  6. name?: string;
  7. }
  8. export interface IGLTFAccessor extends IGLTFChildRootProperty {
  9. bufferView: string;
  10. byteOffset: number;
  11. byteStride: number;
  12. count: number;
  13. type: string;
  14. componentType: EComponentType;
  15. max?: number[],
  16. min?: number[],
  17. name?: string;
  18. }
  19. export interface IGLTFBufferView extends IGLTFChildRootProperty {
  20. buffer: string;
  21. byteOffset: number;
  22. byteLength: number;
  23. target?: number;
  24. }
  25. export interface IGLTFBuffer extends IGLTFChildRootProperty {
  26. uri: string;
  27. byteLength?: number;
  28. type?: string;
  29. }
  30. export interface IGLTFShader extends IGLTFChildRootProperty {
  31. uri: string;
  32. type: EShaderType;
  33. }
  34. export interface IGLTFProgram extends IGLTFChildRootProperty {
  35. attributes: string[];
  36. fragmentShader: string;
  37. vertexShader: string;
  38. }
  39. export interface IGLTFTechniqueParameter {
  40. type: number;
  41. count?: number;
  42. semantic?: string;
  43. node?: string;
  44. value?: number|boolean|string|Array<any>;
  45. source?: string;
  46. babylonValue?: any;
  47. }
  48. export interface IGLTFTechniqueCommonProfile {
  49. lightingModel: string;
  50. texcoordBindings: Object;
  51. parameters?: Array<any>;
  52. }
  53. export interface IGLTFTechniqueStatesFunctions {
  54. blendColor?: number[];
  55. blendEquationSeparate?: number[];
  56. blendFuncSeparate?: number[];
  57. colorMask: boolean[];
  58. cullFace: number[];
  59. }
  60. export interface IGLTFTechniqueStates {
  61. enable: number[];
  62. functions: IGLTFTechniqueStatesFunctions;
  63. }
  64. export interface IGLTFTechnique extends IGLTFChildRootProperty {
  65. parameters: Object;
  66. program: string;
  67. attributes: Object;
  68. uniforms: Object;
  69. states: IGLTFTechniqueStates;
  70. }
  71. export interface IGLTFMaterial extends IGLTFChildRootProperty {
  72. technique?: string;
  73. values: string[];
  74. }
  75. export interface IGLTFMeshPrimitive {
  76. attributes: Object;
  77. indices: string;
  78. material: string;
  79. mode?: number;
  80. }
  81. export interface IGLTFMesh extends IGLTFChildRootProperty {
  82. primitives: IGLTFMeshPrimitive[];
  83. }
  84. export interface IGLTFImage extends IGLTFChildRootProperty {
  85. uri: string;
  86. }
  87. export interface IGLTFSampler extends IGLTFChildRootProperty {
  88. magFilter?: number;
  89. minFilter?: number;
  90. wrapS?: number;
  91. wrapT?: number;
  92. }
  93. export interface IGLTFTexture extends IGLTFChildRootProperty {
  94. sampler: string;
  95. source: string;
  96. format?: ETextureFormat;
  97. internalFormat?: ETextureFormat;
  98. target?: number;
  99. type?: number;
  100. // Babylon.js values (optimize)
  101. babylonTexture?: Texture;
  102. }
  103. export interface IGLTFAmbienLight {
  104. color?: number[];
  105. }
  106. export interface IGLTFDirectionalLight {
  107. color?: number[];
  108. }
  109. export interface IGLTFPointLight {
  110. color?: number[];
  111. constantAttenuation?: number;
  112. linearAttenuation?: number;
  113. quadraticAttenuation?: number;
  114. }
  115. export interface IGLTFSpotLight {
  116. color?: number[];
  117. constantAttenuation?: number;
  118. fallOfAngle?: number;
  119. fallOffExponent?: number;
  120. linearAttenuation?: number;
  121. quadraticAttenuation?: number;
  122. }
  123. export interface IGLTFLight extends IGLTFChildRootProperty {
  124. type: string;
  125. }
  126. export interface IGLTFCameraOrthographic {
  127. xmag: number;
  128. ymag: number;
  129. zfar: number;
  130. znear: number;
  131. }
  132. export interface IGLTFCameraPerspective {
  133. aspectRatio: number;
  134. yfov: number;
  135. zfar: number;
  136. znear: number;
  137. }
  138. export interface IGLTFCamera extends IGLTFChildRootProperty {
  139. type: string;
  140. }
  141. export interface IGLTFAnimationChannelTarget {
  142. id: string;
  143. path: string;
  144. }
  145. export interface IGLTFAnimationChannel {
  146. sampler: string;
  147. target: IGLTFAnimationChannelTarget;
  148. }
  149. export interface IGLTFAnimationSampler {
  150. input: string;
  151. output: string;
  152. interpolation?: string;
  153. }
  154. export interface IGLTFAnimation extends IGLTFChildRootProperty {
  155. channels?: IGLTFAnimationChannel[];
  156. parameters?: Object;
  157. samplers?: Object;
  158. }
  159. export interface IGLTFNodeInstanceSkin {
  160. skeletons: string[];
  161. skin: string;
  162. meshes: string[];
  163. }
  164. export interface IGLTFSkins extends IGLTFChildRootProperty {
  165. bindShapeMatrix: number[];
  166. inverseBindMatrices: string;
  167. jointNames: string[];
  168. babylonSkeleton?: Skeleton;
  169. }
  170. export interface IGLTFNode extends IGLTFChildRootProperty {
  171. camera?: string;
  172. children: string[];
  173. skin?: string;
  174. jointName?: string;
  175. light?: string;
  176. matrix: number[];
  177. mesh?: string;
  178. meshes?: string[];
  179. rotation?: number[];
  180. scale?: number[];
  181. translation?: number[];
  182. // Babylon.js values (optimize)
  183. babylonNode?: Node;
  184. }
  185. export interface IGLTFScene extends IGLTFChildRootProperty {
  186. nodes: string[];
  187. }
  188. /**
  189. * Runtime
  190. */
  191. export interface IGLTFRuntime {
  192. accessors: Object;
  193. buffers: Object;
  194. bufferViews: Object;
  195. meshes: Object;
  196. lights: Object;
  197. cameras: Object;
  198. nodes: Object;
  199. images: Object;
  200. textures: Object;
  201. shaders: Object;
  202. programs: Object;
  203. samplers: Object;
  204. techniques: Object;
  205. materials: Object;
  206. animations: Object;
  207. skins: Object;
  208. currentScene: Object;
  209. buffersCount: number;
  210. shaderscount: number;
  211. scene: Scene;
  212. rootUrl: string;
  213. loadedBuffers: number;
  214. loadedShaders: number;
  215. arrayBuffers: Object;
  216. importOnlyMeshes: boolean;
  217. importMeshesNames?: string[];
  218. dummyNodes: Node[];
  219. }
  220. /**
  221. * Bones
  222. */
  223. export interface INodeToRoot {
  224. bone: Bone;
  225. node: IGLTFNode;
  226. id: string;
  227. }
  228. export interface IJointNode {
  229. node: IGLTFNode;
  230. id: string;
  231. }
  232. }