babylon.glTF2Interface.d.ts 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842
  1. /**
  2. * @ignoreChildren
  3. * @ignore
  4. */
  5. declare module "babylonjs-gltf2interface" {
  6. /**
  7. * The datatype of the components in the attribute
  8. */
  9. export const enum AccessorComponentType {
  10. /**
  11. * Byte
  12. */
  13. BYTE = 5120,
  14. /**
  15. * Unsigned Byte
  16. */
  17. UNSIGNED_BYTE = 5121,
  18. /**
  19. * Short
  20. */
  21. SHORT = 5122,
  22. /**
  23. * Unsigned Short
  24. */
  25. UNSIGNED_SHORT = 5123,
  26. /**
  27. * Unsigned Int
  28. */
  29. UNSIGNED_INT = 5125,
  30. /**
  31. * Float
  32. */
  33. FLOAT = 5126,
  34. }
  35. /**
  36. * Specifies if the attirbute is a scalar, vector, or matrix
  37. */
  38. export const enum AccessorType {
  39. /**
  40. * Scalar
  41. */
  42. SCALAR = "SCALAR",
  43. /**
  44. * Vector2
  45. */
  46. VEC2 = "VEC2",
  47. /**
  48. * Vector3
  49. */
  50. VEC3 = "VEC3",
  51. /**
  52. * Vector4
  53. */
  54. VEC4 = "VEC4",
  55. /**
  56. * Matrix2x2
  57. */
  58. MAT2 = "MAT2",
  59. /**
  60. * Matrix3x3
  61. */
  62. MAT3 = "MAT3",
  63. /**
  64. * Matrix4x4
  65. */
  66. MAT4 = "MAT4",
  67. }
  68. /**
  69. * The name of the node's TRS property to modify, or the weights of the Morph Targets it instantiates
  70. */
  71. export const enum AnimationChannelTargetPath {
  72. /**
  73. * Translation
  74. */
  75. TRANSLATION = "translation",
  76. /**
  77. * Rotation
  78. */
  79. ROTATION = "rotation",
  80. /**
  81. * Scale
  82. */
  83. SCALE = "scale",
  84. /**
  85. * Weights
  86. */
  87. WEIGHTS = "weights",
  88. }
  89. /**
  90. * Interpolation algorithm
  91. */
  92. export const enum AnimationSamplerInterpolation {
  93. /**
  94. * The animated values are linearly interpolated between keyframes
  95. */
  96. LINEAR = "LINEAR",
  97. /**
  98. * The animated values remain constant to the output of the first keyframe, until the next keyframe
  99. */
  100. STEP = "STEP",
  101. /**
  102. * The animation's interpolation is computed using a cubic spline with specified tangents
  103. */
  104. CUBICSPLINE = "CUBICSPLINE",
  105. }
  106. /**
  107. * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene
  108. */
  109. export const enum CameraType {
  110. /**
  111. * A perspective camera containing properties to create a perspective projection matrix
  112. */
  113. PERSPECTIVE = "perspective",
  114. /**
  115. * An orthographic camera containing properties to create an orthographic projection matrix
  116. */
  117. ORTHOGRAPHIC = "orthographic",
  118. }
  119. /**
  120. * The mime-type of the image
  121. */
  122. export const enum ImageMimeType {
  123. /**
  124. * JPEG Mime-type
  125. */
  126. JPEG = "image/jpeg",
  127. /**
  128. * PNG Mime-type
  129. */
  130. PNG = "image/png",
  131. }
  132. /**
  133. * The alpha rendering mode of the material
  134. */
  135. export const enum MaterialAlphaMode {
  136. /**
  137. * The alpha value is ignored and the rendered output is fully opaque
  138. */
  139. OPAQUE = "OPAQUE",
  140. /**
  141. * The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value
  142. */
  143. MASK = "MASK",
  144. /**
  145. * The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator)
  146. */
  147. BLEND = "BLEND",
  148. }
  149. /**
  150. * The type of the primitives to render
  151. */
  152. export const enum MeshPrimitiveMode {
  153. /**
  154. * Points
  155. */
  156. POINTS = 0,
  157. /**
  158. * Lines
  159. */
  160. LINES = 1,
  161. /**
  162. * Line Loop
  163. */
  164. LINE_LOOP = 2,
  165. /**
  166. * Line Strip
  167. */
  168. LINE_STRIP = 3,
  169. /**
  170. * Triangles
  171. */
  172. TRIANGLES = 4,
  173. /**
  174. * Triangle Strip
  175. */
  176. TRIANGLE_STRIP = 5,
  177. /**
  178. * Triangle Fan
  179. */
  180. TRIANGLE_FAN = 6,
  181. }
  182. /**
  183. * Magnification filter. Valid values correspond to WebGL enums: 9728 (NEAREST) and 9729 (LINEAR)
  184. */
  185. export const enum TextureMagFilter {
  186. /**
  187. * Nearest
  188. */
  189. NEAREST = 9728,
  190. /**
  191. * Linear
  192. */
  193. LINEAR = 9729,
  194. }
  195. /**
  196. * Minification filter. All valid values correspond to WebGL enums
  197. */
  198. export const enum TextureMinFilter {
  199. /**
  200. * Nearest
  201. */
  202. NEAREST = 9728,
  203. /**
  204. * Linear
  205. */
  206. LINEAR = 9729,
  207. /**
  208. * Nearest Mip-Map Nearest
  209. */
  210. NEAREST_MIPMAP_NEAREST = 9984,
  211. /**
  212. * Linear Mipmap Nearest
  213. */
  214. LINEAR_MIPMAP_NEAREST = 9985,
  215. /**
  216. * Nearest Mipmap Linear
  217. */
  218. NEAREST_MIPMAP_LINEAR = 9986,
  219. /**
  220. * Linear Mipmap Linear
  221. */
  222. LINEAR_MIPMAP_LINEAR = 9987,
  223. }
  224. /**
  225. * S (U) wrapping mode. All valid values correspond to WebGL enums
  226. */
  227. export const enum TextureWrapMode {
  228. /**
  229. * Clamp to Edge
  230. */
  231. CLAMP_TO_EDGE = 33071,
  232. /**
  233. * Mirrored Repeat
  234. */
  235. MIRRORED_REPEAT = 33648,
  236. /**
  237. * Repeat
  238. */
  239. REPEAT = 10497,
  240. }
  241. /**
  242. * glTF Property
  243. */
  244. export interface IProperty {
  245. /**
  246. * Dictionary object with extension-specific objects
  247. */
  248. extensions?: {
  249. [key: string]: any;
  250. };
  251. /**
  252. * Application-Specific data
  253. */
  254. extras?: any;
  255. }
  256. /**
  257. * glTF Child of Root Property
  258. */
  259. export interface IChildRootProperty extends IProperty {
  260. /**
  261. * The user-defined name of this object
  262. */
  263. name?: string;
  264. }
  265. /**
  266. * Indices of those attributes that deviate from their initialization value
  267. */
  268. export interface IAccessorSparseIndices extends IProperty {
  269. /**
  270. * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target
  271. */
  272. bufferView: number;
  273. /**
  274. * The offset relative to the start of the bufferView in bytes. Must be aligned
  275. */
  276. byteOffset?: number;
  277. /**
  278. * The indices data type. Valid values correspond to WebGL enums: 5121 (UNSIGNED_BYTE), 5123 (UNSIGNED_SHORT), 5125 (UNSIGNED_INT)
  279. */
  280. componentType: AccessorComponentType;
  281. }
  282. /**
  283. * Array of size accessor.sparse.count times number of components storing the displaced accessor attributes pointed by accessor.sparse.indices
  284. */
  285. export interface IAccessorSparseValues extends IProperty {
  286. /**
  287. * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target
  288. */
  289. bufferView: number;
  290. /**
  291. * The offset relative to the start of the bufferView in bytes. Must be aligned
  292. */
  293. byteOffset?: number;
  294. }
  295. /**
  296. * Sparse storage of attributes that deviate from their initialization value
  297. */
  298. export interface IAccessorSparse extends IProperty {
  299. /**
  300. * The number of attributes encoded in this sparse accessor
  301. */
  302. count: number;
  303. /**
  304. * Index array of size count that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase
  305. */
  306. indices: IAccessorSparseIndices;
  307. /**
  308. * Array of size count times number of components, storing the displaced accessor attributes pointed by indices. Substituted values must have the same componentType and number of components as the base accessor
  309. */
  310. values: IAccessorSparseValues;
  311. }
  312. /**
  313. * A typed view into a bufferView. A bufferView contains raw binary data. An accessor provides a typed view into a bufferView or a subset of a bufferView similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer
  314. */
  315. export interface IAccessor extends IChildRootProperty {
  316. /**
  317. * The index of the bufferview
  318. */
  319. bufferView?: number;
  320. /**
  321. * The offset relative to the start of the bufferView in bytes
  322. */
  323. byteOffset?: number;
  324. /**
  325. * The datatype of components in the attribute
  326. */
  327. componentType: AccessorComponentType;
  328. /**
  329. * Specifies whether integer data values should be normalized
  330. */
  331. normalized?: boolean;
  332. /**
  333. * The number of attributes referenced by this accessor
  334. */
  335. count: number;
  336. /**
  337. * Specifies if the attribute is a scalar, vector, or matrix
  338. */
  339. type: AccessorType;
  340. /**
  341. * Maximum value of each component in this attribute
  342. */
  343. max?: number[];
  344. /**
  345. * Minimum value of each component in this attribute
  346. */
  347. min?: number[];
  348. /**
  349. * Sparse storage of attributes that deviate from their initialization value
  350. */
  351. sparse?: IAccessorSparse;
  352. }
  353. /**
  354. * Targets an animation's sampler at a node's property
  355. */
  356. export interface IAnimationChannel extends IProperty {
  357. /**
  358. * The index of a sampler in this animation used to compute the value for the target
  359. */
  360. sampler: number;
  361. /**
  362. * The index of the node and TRS property to target
  363. */
  364. target: IAnimationChannelTarget;
  365. }
  366. /**
  367. * The index of the node and TRS property that an animation channel targets
  368. */
  369. export interface IAnimationChannelTarget extends IProperty {
  370. /**
  371. * The index of the node to target
  372. */
  373. node: number;
  374. /**
  375. * The name of the node's TRS property to modify, or the weights of the Morph Targets it instantiates
  376. */
  377. path: AnimationChannelTargetPath;
  378. }
  379. /**
  380. * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)
  381. */
  382. export interface IAnimationSampler extends IProperty {
  383. /**
  384. * The index of an accessor containing keyframe input values, e.g., time
  385. */
  386. input: number;
  387. /**
  388. * Interpolation algorithm
  389. */
  390. interpolation?: AnimationSamplerInterpolation;
  391. /**
  392. * The index of an accessor, containing keyframe output values
  393. */
  394. output: number;
  395. }
  396. /**
  397. * A keyframe animation
  398. */
  399. export interface IAnimation extends IChildRootProperty {
  400. /**
  401. * An array of channels, each of which targets an animation's sampler at a node's property
  402. */
  403. channels: IAnimationChannel[];
  404. /**
  405. * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)
  406. */
  407. samplers: IAnimationSampler[];
  408. }
  409. /**
  410. * Metadata about the glTF asset
  411. */
  412. export interface IAsset extends IChildRootProperty {
  413. /**
  414. * A copyright message suitable for display to credit the content creator
  415. */
  416. copyright?: string;
  417. /**
  418. * Tool that generated this glTF model. Useful for debugging
  419. */
  420. generator?: string;
  421. /**
  422. * The glTF version that this asset targets
  423. */
  424. version: string;
  425. /**
  426. * The minimum glTF version that this asset targets
  427. */
  428. minVersion?: string;
  429. }
  430. /**
  431. * A buffer points to binary geometry, animation, or skins
  432. */
  433. export interface IBuffer extends IChildRootProperty {
  434. /**
  435. * The uri of the buffer. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri
  436. */
  437. uri?: string;
  438. /**
  439. * The length of the buffer in bytes
  440. */
  441. byteLength: number;
  442. }
  443. /**
  444. * A view into a buffer generally representing a subset of the buffer
  445. */
  446. export interface IBufferView extends IChildRootProperty {
  447. /**
  448. * The index of the buffer
  449. */
  450. buffer: number;
  451. /**
  452. * The offset into the buffer in bytes
  453. */
  454. byteOffset?: number;
  455. /**
  456. * The lenth of the bufferView in bytes
  457. */
  458. byteLength: number;
  459. /**
  460. * The stride, in bytes
  461. */
  462. byteStride?: number;
  463. }
  464. /**
  465. * An orthographic camera containing properties to create an orthographic projection matrix
  466. */
  467. export interface ICameraOrthographic extends IProperty {
  468. /**
  469. * The floating-point horizontal magnification of the view. Must not be zero
  470. */
  471. xmag: number;
  472. /**
  473. * The floating-point vertical magnification of the view. Must not be zero
  474. */
  475. ymag: number;
  476. /**
  477. * The floating-point distance to the far clipping plane. zfar must be greater than znear
  478. */
  479. zfar: number;
  480. /**
  481. * The floating-point distance to the near clipping plane
  482. */
  483. znear: number;
  484. }
  485. /**
  486. * A perspective camera containing properties to create a perspective projection matrix
  487. */
  488. export interface ICameraPerspective extends IProperty {
  489. /**
  490. * The floating-point aspect ratio of the field of view
  491. */
  492. aspectRatio?: number;
  493. /**
  494. * The floating-point vertical field of view in radians
  495. */
  496. yfov: number;
  497. /**
  498. * The floating-point distance to the far clipping plane
  499. */
  500. zfar?: number;
  501. /**
  502. * The floating-point distance to the near clipping plane
  503. */
  504. znear: number;
  505. }
  506. /**
  507. * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene
  508. */
  509. export interface ICamera extends IChildRootProperty {
  510. /**
  511. * An orthographic camera containing properties to create an orthographic projection matrix
  512. */
  513. orthographic?: ICameraOrthographic;
  514. /**
  515. * A perspective camera containing properties to create a perspective projection matrix
  516. */
  517. perspective?: ICameraPerspective;
  518. /**
  519. * Specifies if the camera uses a perspective or orthographic projection
  520. */
  521. type: CameraType;
  522. }
  523. /**
  524. * Image data used to create a texture. Image can be referenced by URI or bufferView index. mimeType is required in the latter case
  525. */
  526. export interface IImage extends IChildRootProperty {
  527. /**
  528. * The uri of the image. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri. The image format must be jpg or png
  529. */
  530. uri?: string;
  531. /**
  532. * The image's MIME type
  533. */
  534. mimeType?: ImageMimeType;
  535. /**
  536. * The index of the bufferView that contains the image. Use this instead of the image's uri property
  537. */
  538. bufferView?: number;
  539. }
  540. /**
  541. * Material Normal Texture Info
  542. */
  543. export interface IMaterialNormalTextureInfo extends ITextureInfo {
  544. /**
  545. * The scalar multiplier applied to each normal vector of the normal texture
  546. */
  547. scale?: number;
  548. }
  549. /**
  550. * Material Occlusion Texture Info
  551. */
  552. export interface IMaterialOcclusionTextureInfo extends ITextureInfo {
  553. /**
  554. * A scalar multiplier controlling the amount of occlusion applied
  555. */
  556. strength?: number;
  557. }
  558. /**
  559. * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology
  560. */
  561. export interface IMaterialPbrMetallicRoughness {
  562. /**
  563. * The material's base color factor
  564. */
  565. baseColorFactor?: number[];
  566. /**
  567. * The base color texture
  568. */
  569. baseColorTexture?: ITextureInfo;
  570. /**
  571. * The metalness of the material
  572. */
  573. metallicFactor?: number;
  574. /**
  575. * The roughness of the material
  576. */
  577. roughnessFactor?: number;
  578. /**
  579. * The metallic-roughness texture
  580. */
  581. metallicRoughnessTexture?: ITextureInfo;
  582. }
  583. /**
  584. * The material appearance of a primitive
  585. */
  586. export interface IMaterial extends IChildRootProperty {
  587. /**
  588. * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply
  589. */
  590. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  591. /**
  592. * The normal map texture
  593. */
  594. normalTexture?: IMaterialNormalTextureInfo;
  595. /**
  596. * The occlusion map texture
  597. */
  598. occlusionTexture?: IMaterialOcclusionTextureInfo;
  599. /**
  600. * The emissive map texture
  601. */
  602. emissiveTexture?: ITextureInfo;
  603. /**
  604. * The RGB components of the emissive color of the material. These values are linear. If an emissiveTexture is specified, this value is multiplied with the texel values
  605. */
  606. emissiveFactor?: number[];
  607. /**
  608. * The alpha rendering mode of the material
  609. */
  610. alphaMode?: MaterialAlphaMode;
  611. /**
  612. * The alpha cutoff value of the material
  613. */
  614. alphaCutoff?: number;
  615. /**
  616. * Specifies whether the material is double sided
  617. */
  618. doubleSided?: boolean;
  619. }
  620. /**
  621. * Geometry to be rendered with the given material
  622. */
  623. export interface IMeshPrimitive extends IProperty {
  624. /**
  625. * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data
  626. */
  627. attributes: {
  628. [name: string]: number;
  629. };
  630. /**
  631. * The index of the accessor that contains the indices
  632. */
  633. indices?: number;
  634. /**
  635. * The index of the material to apply to this primitive when rendering
  636. */
  637. material?: number;
  638. /**
  639. * The type of primitives to render. All valid values correspond to WebGL enums
  640. */
  641. mode?: MeshPrimitiveMode;
  642. /**
  643. * An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only POSITION, NORMAL, and TANGENT supported) to their deviations in the Morph Target
  644. */
  645. targets?: {
  646. [name: string]: number;
  647. }[];
  648. }
  649. /**
  650. * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene
  651. */
  652. export interface IMesh extends IChildRootProperty {
  653. /**
  654. * An array of primitives, each defining geometry to be rendered with a material
  655. */
  656. primitives: IMeshPrimitive[];
  657. /**
  658. * Array of weights to be applied to the Morph Targets
  659. */
  660. weights?: number[];
  661. }
  662. /**
  663. * A node in the node hierarchy
  664. */
  665. export interface INode extends IChildRootProperty {
  666. /**
  667. * The index of the camera referenced by this node
  668. */
  669. camera?: number;
  670. /**
  671. * The indices of this node's children
  672. */
  673. children?: number[];
  674. /**
  675. * The index of the skin referenced by this node
  676. */
  677. skin?: number;
  678. /**
  679. * A floating-point 4x4 transformation matrix stored in column-major order
  680. */
  681. matrix?: number[];
  682. /**
  683. * The index of the mesh in this node
  684. */
  685. mesh?: number;
  686. /**
  687. * The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar
  688. */
  689. rotation?: number[];
  690. /**
  691. * The node's non-uniform scale, given as the scaling factors along the x, y, and z axes
  692. */
  693. scale?: number[];
  694. /**
  695. * The node's translation along the x, y, and z axes
  696. */
  697. translation?: number[];
  698. /**
  699. * The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh
  700. */
  701. weights?: number[];
  702. }
  703. /**
  704. * Texture sampler properties for filtering and wrapping modes
  705. */
  706. export interface ISampler extends IChildRootProperty {
  707. /**
  708. * Magnification filter. Valid values correspond to WebGL enums: 9728 (NEAREST) and 9729 (LINEAR)
  709. */
  710. magFilter?: TextureMagFilter;
  711. /**
  712. * Minification filter. All valid values correspond to WebGL enums
  713. */
  714. minFilter?: TextureMinFilter;
  715. /**
  716. * S (U) wrapping mode. All valid values correspond to WebGL enums
  717. */
  718. wrapS?: TextureWrapMode;
  719. /**
  720. * T (V) wrapping mode. All valid values correspond to WebGL enums
  721. */
  722. wrapT?: TextureWrapMode;
  723. }
  724. /**
  725. * The root nodes of a scene
  726. */
  727. export interface IScene extends IChildRootProperty {
  728. /**
  729. * The indices of each root node
  730. */
  731. nodes: number[];
  732. }
  733. /**
  734. * Joints and matrices defining a skin
  735. */
  736. export interface ISkin extends IChildRootProperty {
  737. /**
  738. * The index of the accessor containing the floating-point 4x4 inverse-bind matrices. The default is that each matrix is a 4x4 identity matrix, which implies that inverse-bind matrices were pre-applied
  739. */
  740. inverseBindMatrices?: number;
  741. /**
  742. * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root
  743. */
  744. skeleton?: number;
  745. /**
  746. * Indices of skeleton nodes, used as joints in this skin. The array length must be the same as the count property of the inverseBindMatrices accessor (when defined)
  747. */
  748. joints: number[];
  749. }
  750. /**
  751. * A texture and its sampler
  752. */
  753. export interface ITexture extends IChildRootProperty {
  754. /**
  755. * The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used
  756. */
  757. sampler?: number;
  758. /**
  759. * The index of the image used by this texture
  760. */
  761. source: number;
  762. }
  763. /**
  764. * Reference to a texture
  765. */
  766. export interface ITextureInfo extends IProperty {
  767. /**
  768. * The index of the texture
  769. */
  770. index: number;
  771. /**
  772. * The set index of texture's TEXCOORD attribute used for texture coordinate mapping
  773. */
  774. texCoord?: number;
  775. }
  776. /**
  777. * The root object for a glTF asset
  778. */
  779. export interface IGLTF extends IProperty {
  780. /**
  781. * An array of accessors. An accessor is a typed view into a bufferView
  782. */
  783. accessors?: IAccessor[];
  784. /**
  785. * An array of keyframe animations
  786. */
  787. animations?: IAnimation[];
  788. /**
  789. * Metadata about the glTF asset
  790. */
  791. asset: IAsset;
  792. /**
  793. * An array of buffers. A buffer points to binary geometry, animation, or skins
  794. */
  795. buffers?: IBuffer[];
  796. /**
  797. * An array of bufferViews. A bufferView is a view into a buffer generally representing a subset of the buffer
  798. */
  799. bufferViews?: IBufferView[];
  800. /**
  801. * An array of cameras
  802. */
  803. cameras?: ICamera[];
  804. /**
  805. * Names of glTF extensions used somewhere in this asset
  806. */
  807. extensionsUsed?: string[];
  808. /**
  809. * Names of glTF extensions required to properly load this asset
  810. */
  811. extensionsRequired?: string[];
  812. /**
  813. * An array of images. An image defines data used to create a texture
  814. */
  815. images?: IImage[];
  816. /**
  817. * An array of materials. A material defines the appearance of a primitive
  818. */
  819. materials?: IMaterial[];
  820. /**
  821. * An array of meshes. A mesh is a set of primitives to be rendered
  822. */
  823. meshes?: IMesh[];
  824. /**
  825. * An array of nodes
  826. */
  827. nodes?: INode[];
  828. /**
  829. * An array of samplers. A sampler contains properties for texture filtering and wrapping modes
  830. */
  831. samplers?: ISampler[];
  832. /**
  833. * The index of the default scene
  834. */
  835. scene?: number;
  836. /**
  837. * An array of scenes
  838. */
  839. scenes?: IScene[];
  840. /**
  841. * An array of skins. A skin is defined by joints and matrices
  842. */
  843. skins?: ISkin[];
  844. /**
  845. * An array of textures
  846. */
  847. textures?: ITexture[];
  848. }
  849. /**
  850. * Interface for glTF validation results
  851. */
  852. export interface IGLTFValidationResults {
  853. info: {
  854. generator: string;
  855. hasAnimations: boolean;
  856. hasDefaultScene: boolean;
  857. hasMaterials: boolean;
  858. hasMorphTargets: boolean;
  859. hasSkins: boolean;
  860. hasTextures: boolean;
  861. maxAttributesUsed: number;
  862. primitivesCount: number
  863. };
  864. issues: {
  865. messages: Array<string>;
  866. numErrors: number;
  867. numHints: number;
  868. numInfos: number;
  869. numWarnings: number;
  870. truncated: boolean
  871. };
  872. mimeType: string;
  873. uri: string;
  874. validatedAt: string;
  875. validatorVersion: string;
  876. }
  877. /**
  878. * Interface for glTF validation options
  879. */
  880. export interface IGLTFValidationOptions {
  881. uri?: string;
  882. externalResourceFunction?: (uri: string) => Promise<Uint8Array>;
  883. validateAccessorData?: boolean;
  884. maxIssues?: number;
  885. ignoredIssues?: Array<string>;
  886. severityOverrides?: Object;
  887. }
  888. /**
  889. * glTF validator object Tyyings
  890. */
  891. export interface IGLTFValidatorTypings {
  892. validateString: (json: string, options?: IGLTFValidationOptions) => Promise<IGLTFValidationResults>;
  893. }
  894. }
  895. /**
  896. * Module for glTF 2.0 Interface
  897. */
  898. declare module BABYLON.GLTF2 {
  899. /**
  900. * The datatype of the components in the attribute
  901. */
  902. const enum AccessorComponentType {
  903. /**
  904. * Byte
  905. */
  906. BYTE = 5120,
  907. /**
  908. * Unsigned Byte
  909. */
  910. UNSIGNED_BYTE = 5121,
  911. /**
  912. * Short
  913. */
  914. SHORT = 5122,
  915. /**
  916. * Unsigned Short
  917. */
  918. UNSIGNED_SHORT = 5123,
  919. /**
  920. * Unsigned Int
  921. */
  922. UNSIGNED_INT = 5125,
  923. /**
  924. * Float
  925. */
  926. FLOAT = 5126,
  927. }
  928. /**
  929. * Specifies if the attirbute is a scalar, vector, or matrix
  930. */
  931. const enum AccessorType {
  932. /**
  933. * Scalar
  934. */
  935. SCALAR = "SCALAR",
  936. /**
  937. * Vector2
  938. */
  939. VEC2 = "VEC2",
  940. /**
  941. * Vector3
  942. */
  943. VEC3 = "VEC3",
  944. /**
  945. * Vector4
  946. */
  947. VEC4 = "VEC4",
  948. /**
  949. * Matrix2x2
  950. */
  951. MAT2 = "MAT2",
  952. /**
  953. * Matrix3x3
  954. */
  955. MAT3 = "MAT3",
  956. /**
  957. * Matrix4x4
  958. */
  959. MAT4 = "MAT4",
  960. }
  961. /**
  962. * The name of the node's TRS property to modify, or the weights of the Morph Targets it instantiates
  963. */
  964. const enum AnimationChannelTargetPath {
  965. /**
  966. * Translation
  967. */
  968. TRANSLATION = "translation",
  969. /**
  970. * Rotation
  971. */
  972. ROTATION = "rotation",
  973. /**
  974. * Scale
  975. */
  976. SCALE = "scale",
  977. /**
  978. * Weights
  979. */
  980. WEIGHTS = "weights",
  981. }
  982. /**
  983. * Interpolation algorithm
  984. */
  985. const enum AnimationSamplerInterpolation {
  986. /**
  987. * The animated values are linearly interpolated between keyframes
  988. */
  989. LINEAR = "LINEAR",
  990. /**
  991. * The animated values remain constant to the output of the first keyframe, until the next keyframe
  992. */
  993. STEP = "STEP",
  994. /**
  995. * The animation's interpolation is computed using a cubic spline with specified tangents
  996. */
  997. CUBICSPLINE = "CUBICSPLINE",
  998. }
  999. /**
  1000. * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene
  1001. */
  1002. const enum CameraType {
  1003. /**
  1004. * A perspective camera containing properties to create a perspective projection matrix
  1005. */
  1006. PERSPECTIVE = "perspective",
  1007. /**
  1008. * An orthographic camera containing properties to create an orthographic projection matrix
  1009. */
  1010. ORTHOGRAPHIC = "orthographic",
  1011. }
  1012. /**
  1013. * The mime-type of the image
  1014. */
  1015. const enum ImageMimeType {
  1016. /**
  1017. * JPEG Mime-type
  1018. */
  1019. JPEG = "image/jpeg",
  1020. /**
  1021. * PNG Mime-type
  1022. */
  1023. PNG = "image/png",
  1024. }
  1025. /**
  1026. * The alpha rendering mode of the material
  1027. */
  1028. const enum MaterialAlphaMode {
  1029. /**
  1030. * The alpha value is ignored and the rendered output is fully opaque
  1031. */
  1032. OPAQUE = "OPAQUE",
  1033. /**
  1034. * The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value
  1035. */
  1036. MASK = "MASK",
  1037. /**
  1038. * The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator)
  1039. */
  1040. BLEND = "BLEND",
  1041. }
  1042. /**
  1043. * The type of the primitives to render
  1044. */
  1045. const enum MeshPrimitiveMode {
  1046. /**
  1047. * Points
  1048. */
  1049. POINTS = 0,
  1050. /**
  1051. * Lines
  1052. */
  1053. LINES = 1,
  1054. /**
  1055. * Line Loop
  1056. */
  1057. LINE_LOOP = 2,
  1058. /**
  1059. * Line Strip
  1060. */
  1061. LINE_STRIP = 3,
  1062. /**
  1063. * Triangles
  1064. */
  1065. TRIANGLES = 4,
  1066. /**
  1067. * Triangle Strip
  1068. */
  1069. TRIANGLE_STRIP = 5,
  1070. /**
  1071. * Triangle Fan
  1072. */
  1073. TRIANGLE_FAN = 6,
  1074. }
  1075. /**
  1076. * Magnification filter. Valid values correspond to WebGL enums: 9728 (NEAREST) and 9729 (LINEAR)
  1077. */
  1078. const enum TextureMagFilter {
  1079. /**
  1080. * Nearest
  1081. */
  1082. NEAREST = 9728,
  1083. /**
  1084. * Linear
  1085. */
  1086. LINEAR = 9729,
  1087. }
  1088. /**
  1089. * Minification filter. All valid values correspond to WebGL enums
  1090. */
  1091. const enum TextureMinFilter {
  1092. /**
  1093. * Nearest
  1094. */
  1095. NEAREST = 9728,
  1096. /**
  1097. * Linear
  1098. */
  1099. LINEAR = 9729,
  1100. /**
  1101. * Nearest Mip-Map Nearest
  1102. */
  1103. NEAREST_MIPMAP_NEAREST = 9984,
  1104. /**
  1105. * Linear Mipmap Nearest
  1106. */
  1107. LINEAR_MIPMAP_NEAREST = 9985,
  1108. /**
  1109. * Nearest Mipmap Linear
  1110. */
  1111. NEAREST_MIPMAP_LINEAR = 9986,
  1112. /**
  1113. * Linear Mipmap Linear
  1114. */
  1115. LINEAR_MIPMAP_LINEAR = 9987,
  1116. }
  1117. /**
  1118. * S (U) wrapping mode. All valid values correspond to WebGL enums
  1119. */
  1120. const enum TextureWrapMode {
  1121. /**
  1122. * Clamp to Edge
  1123. */
  1124. CLAMP_TO_EDGE = 33071,
  1125. /**
  1126. * Mirrored Repeat
  1127. */
  1128. MIRRORED_REPEAT = 33648,
  1129. /**
  1130. * Repeat
  1131. */
  1132. REPEAT = 10497,
  1133. }
  1134. /**
  1135. * glTF Property
  1136. */
  1137. interface IProperty {
  1138. /**
  1139. * Dictionary object with extension-specific objects
  1140. */
  1141. extensions?: {
  1142. [key: string]: any;
  1143. };
  1144. /**
  1145. * Application-Specific data
  1146. */
  1147. extras?: any;
  1148. }
  1149. /**
  1150. * glTF Child of Root Property
  1151. */
  1152. interface IChildRootProperty extends IProperty {
  1153. /**
  1154. * The user-defined name of this object
  1155. */
  1156. name?: string;
  1157. }
  1158. /**
  1159. * Indices of those attributes that deviate from their initialization value
  1160. */
  1161. interface IAccessorSparseIndices extends IProperty {
  1162. /**
  1163. * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target
  1164. */
  1165. bufferView: number;
  1166. /**
  1167. * The offset relative to the start of the bufferView in bytes. Must be aligned
  1168. */
  1169. byteOffset?: number;
  1170. /**
  1171. * The indices data type. Valid values correspond to WebGL enums: 5121 (UNSIGNED_BYTE), 5123 (UNSIGNED_SHORT), 5125 (UNSIGNED_INT)
  1172. */
  1173. componentType: AccessorComponentType;
  1174. }
  1175. /**
  1176. * Array of size accessor.sparse.count times number of components storing the displaced accessor attributes pointed by accessor.sparse.indices
  1177. */
  1178. interface IAccessorSparseValues extends IProperty {
  1179. /**
  1180. * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target
  1181. */
  1182. bufferView: number;
  1183. /**
  1184. * The offset relative to the start of the bufferView in bytes. Must be aligned
  1185. */
  1186. byteOffset?: number;
  1187. }
  1188. /**
  1189. * Sparse storage of attributes that deviate from their initialization value
  1190. */
  1191. interface IAccessorSparse extends IProperty {
  1192. /**
  1193. * The number of attributes encoded in this sparse accessor
  1194. */
  1195. count: number;
  1196. /**
  1197. * Index array of size count that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase
  1198. */
  1199. indices: IAccessorSparseIndices;
  1200. /**
  1201. * Array of size count times number of components, storing the displaced accessor attributes pointed by indices. Substituted values must have the same componentType and number of components as the base accessor
  1202. */
  1203. values: IAccessorSparseValues;
  1204. }
  1205. /**
  1206. * A typed view into a bufferView. A bufferView contains raw binary data. An accessor provides a typed view into a bufferView or a subset of a bufferView similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer
  1207. */
  1208. interface IAccessor extends IChildRootProperty {
  1209. /**
  1210. * The index of the bufferview
  1211. */
  1212. bufferView?: number;
  1213. /**
  1214. * The offset relative to the start of the bufferView in bytes
  1215. */
  1216. byteOffset?: number;
  1217. /**
  1218. * The datatype of components in the attribute
  1219. */
  1220. componentType: AccessorComponentType;
  1221. /**
  1222. * Specifies whether integer data values should be normalized
  1223. */
  1224. normalized?: boolean;
  1225. /**
  1226. * The number of attributes referenced by this accessor
  1227. */
  1228. count: number;
  1229. /**
  1230. * Specifies if the attribute is a scalar, vector, or matrix
  1231. */
  1232. type: AccessorType;
  1233. /**
  1234. * Maximum value of each component in this attribute
  1235. */
  1236. max?: number[];
  1237. /**
  1238. * Minimum value of each component in this attribute
  1239. */
  1240. min?: number[];
  1241. /**
  1242. * Sparse storage of attributes that deviate from their initialization value
  1243. */
  1244. sparse?: IAccessorSparse;
  1245. }
  1246. /**
  1247. * Targets an animation's sampler at a node's property
  1248. */
  1249. interface IAnimationChannel extends IProperty {
  1250. /**
  1251. * The index of a sampler in this animation used to compute the value for the target
  1252. */
  1253. sampler: number;
  1254. /**
  1255. * The index of the node and TRS property to target
  1256. */
  1257. target: IAnimationChannelTarget;
  1258. }
  1259. /**
  1260. * The index of the node and TRS property that an animation channel targets
  1261. */
  1262. interface IAnimationChannelTarget extends IProperty {
  1263. /**
  1264. * The index of the node to target
  1265. */
  1266. node: number;
  1267. /**
  1268. * The name of the node's TRS property to modify, or the weights of the Morph Targets it instantiates
  1269. */
  1270. path: AnimationChannelTargetPath;
  1271. }
  1272. /**
  1273. * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)
  1274. */
  1275. interface IAnimationSampler extends IProperty {
  1276. /**
  1277. * The index of an accessor containing keyframe input values, e.g., time
  1278. */
  1279. input: number;
  1280. /**
  1281. * Interpolation algorithm
  1282. */
  1283. interpolation?: AnimationSamplerInterpolation;
  1284. /**
  1285. * The index of an accessor, containing keyframe output values
  1286. */
  1287. output: number;
  1288. }
  1289. /**
  1290. * A keyframe animation
  1291. */
  1292. interface IAnimation extends IChildRootProperty {
  1293. /**
  1294. * An array of channels, each of which targets an animation's sampler at a node's property
  1295. */
  1296. channels: IAnimationChannel[];
  1297. /**
  1298. * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)
  1299. */
  1300. samplers: IAnimationSampler[];
  1301. }
  1302. /**
  1303. * Metadata about the glTF asset
  1304. */
  1305. interface IAsset extends IChildRootProperty {
  1306. /**
  1307. * A copyright message suitable for display to credit the content creator
  1308. */
  1309. copyright?: string;
  1310. /**
  1311. * Tool that generated this glTF model. Useful for debugging
  1312. */
  1313. generator?: string;
  1314. /**
  1315. * The glTF version that this asset targets
  1316. */
  1317. version: string;
  1318. /**
  1319. * The minimum glTF version that this asset targets
  1320. */
  1321. minVersion?: string;
  1322. }
  1323. /**
  1324. * A buffer points to binary geometry, animation, or skins
  1325. */
  1326. interface IBuffer extends IChildRootProperty {
  1327. /**
  1328. * The uri of the buffer. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri
  1329. */
  1330. uri?: string;
  1331. /**
  1332. * The length of the buffer in bytes
  1333. */
  1334. byteLength: number;
  1335. }
  1336. /**
  1337. * A view into a buffer generally representing a subset of the buffer
  1338. */
  1339. interface IBufferView extends IChildRootProperty {
  1340. /**
  1341. * The index of the buffer
  1342. */
  1343. buffer: number;
  1344. /**
  1345. * The offset into the buffer in bytes
  1346. */
  1347. byteOffset?: number;
  1348. /**
  1349. * The lenth of the bufferView in bytes
  1350. */
  1351. byteLength: number;
  1352. /**
  1353. * The stride, in bytes
  1354. */
  1355. byteStride?: number;
  1356. }
  1357. /**
  1358. * An orthographic camera containing properties to create an orthographic projection matrix
  1359. */
  1360. interface ICameraOrthographic extends IProperty {
  1361. /**
  1362. * The floating-point horizontal magnification of the view. Must not be zero
  1363. */
  1364. xmag: number;
  1365. /**
  1366. * The floating-point vertical magnification of the view. Must not be zero
  1367. */
  1368. ymag: number;
  1369. /**
  1370. * The floating-point distance to the far clipping plane. zfar must be greater than znear
  1371. */
  1372. zfar: number;
  1373. /**
  1374. * The floating-point distance to the near clipping plane
  1375. */
  1376. znear: number;
  1377. }
  1378. /**
  1379. * A perspective camera containing properties to create a perspective projection matrix
  1380. */
  1381. interface ICameraPerspective extends IProperty {
  1382. /**
  1383. * The floating-point aspect ratio of the field of view
  1384. */
  1385. aspectRatio?: number;
  1386. /**
  1387. * The floating-point vertical field of view in radians
  1388. */
  1389. yfov: number;
  1390. /**
  1391. * The floating-point distance to the far clipping plane
  1392. */
  1393. zfar?: number;
  1394. /**
  1395. * The floating-point distance to the near clipping plane
  1396. */
  1397. znear: number;
  1398. }
  1399. /**
  1400. * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene
  1401. */
  1402. interface ICamera extends IChildRootProperty {
  1403. /**
  1404. * An orthographic camera containing properties to create an orthographic projection matrix
  1405. */
  1406. orthographic?: ICameraOrthographic;
  1407. /**
  1408. * A perspective camera containing properties to create a perspective projection matrix
  1409. */
  1410. perspective?: ICameraPerspective;
  1411. /**
  1412. * Specifies if the camera uses a perspective or orthographic projection
  1413. */
  1414. type: CameraType;
  1415. }
  1416. /**
  1417. * Image data used to create a texture. Image can be referenced by URI or bufferView index. mimeType is required in the latter case
  1418. */
  1419. interface IImage extends IChildRootProperty {
  1420. /**
  1421. * The uri of the image. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri. The image format must be jpg or png
  1422. */
  1423. uri?: string;
  1424. /**
  1425. * The image's MIME type
  1426. */
  1427. mimeType?: ImageMimeType;
  1428. /**
  1429. * The index of the bufferView that contains the image. Use this instead of the image's uri property
  1430. */
  1431. bufferView?: number;
  1432. }
  1433. /**
  1434. * Material Normal Texture Info
  1435. */
  1436. interface IMaterialNormalTextureInfo extends ITextureInfo {
  1437. /**
  1438. * The scalar multiplier applied to each normal vector of the normal texture
  1439. */
  1440. scale?: number;
  1441. }
  1442. /**
  1443. * Material Occlusion Texture Info
  1444. */
  1445. interface IMaterialOcclusionTextureInfo extends ITextureInfo {
  1446. /**
  1447. * A scalar multiplier controlling the amount of occlusion applied
  1448. */
  1449. strength?: number;
  1450. }
  1451. /**
  1452. * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology
  1453. */
  1454. interface IMaterialPbrMetallicRoughness {
  1455. /**
  1456. * The material's base color factor
  1457. */
  1458. baseColorFactor?: number[];
  1459. /**
  1460. * The base color texture
  1461. */
  1462. baseColorTexture?: ITextureInfo;
  1463. /**
  1464. * The metalness of the material
  1465. */
  1466. metallicFactor?: number;
  1467. /**
  1468. * The roughness of the material
  1469. */
  1470. roughnessFactor?: number;
  1471. /**
  1472. * The metallic-roughness texture
  1473. */
  1474. metallicRoughnessTexture?: ITextureInfo;
  1475. }
  1476. /**
  1477. * The material appearance of a primitive
  1478. */
  1479. interface IMaterial extends IChildRootProperty {
  1480. /**
  1481. * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply
  1482. */
  1483. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  1484. /**
  1485. * The normal map texture
  1486. */
  1487. normalTexture?: IMaterialNormalTextureInfo;
  1488. /**
  1489. * The occlusion map texture
  1490. */
  1491. occlusionTexture?: IMaterialOcclusionTextureInfo;
  1492. /**
  1493. * The emissive map texture
  1494. */
  1495. emissiveTexture?: ITextureInfo;
  1496. /**
  1497. * The RGB components of the emissive color of the material. These values are linear. If an emissiveTexture is specified, this value is multiplied with the texel values
  1498. */
  1499. emissiveFactor?: number[];
  1500. /**
  1501. * The alpha rendering mode of the material
  1502. */
  1503. alphaMode?: MaterialAlphaMode;
  1504. /**
  1505. * The alpha cutoff value of the material
  1506. */
  1507. alphaCutoff?: number;
  1508. /**
  1509. * Specifies whether the material is double sided
  1510. */
  1511. doubleSided?: boolean;
  1512. }
  1513. /**
  1514. * Geometry to be rendered with the given material
  1515. */
  1516. interface IMeshPrimitive extends IProperty {
  1517. /**
  1518. * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data
  1519. */
  1520. attributes: {
  1521. [name: string]: number;
  1522. };
  1523. /**
  1524. * The index of the accessor that contains the indices
  1525. */
  1526. indices?: number;
  1527. /**
  1528. * The index of the material to apply to this primitive when rendering
  1529. */
  1530. material?: number;
  1531. /**
  1532. * The type of primitives to render. All valid values correspond to WebGL enums
  1533. */
  1534. mode?: MeshPrimitiveMode;
  1535. /**
  1536. * An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only POSITION, NORMAL, and TANGENT supported) to their deviations in the Morph Target
  1537. */
  1538. targets?: {
  1539. [name: string]: number;
  1540. }[];
  1541. }
  1542. /**
  1543. * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene
  1544. */
  1545. interface IMesh extends IChildRootProperty {
  1546. /**
  1547. * An array of primitives, each defining geometry to be rendered with a material
  1548. */
  1549. primitives: IMeshPrimitive[];
  1550. /**
  1551. * Array of weights to be applied to the Morph Targets
  1552. */
  1553. weights?: number[];
  1554. }
  1555. /**
  1556. * A node in the node hierarchy
  1557. */
  1558. interface INode extends IChildRootProperty {
  1559. /**
  1560. * The index of the camera referenced by this node
  1561. */
  1562. camera?: number;
  1563. /**
  1564. * The indices of this node's children
  1565. */
  1566. children?: number[];
  1567. /**
  1568. * The index of the skin referenced by this node
  1569. */
  1570. skin?: number;
  1571. /**
  1572. * A floating-point 4x4 transformation matrix stored in column-major order
  1573. */
  1574. matrix?: number[];
  1575. /**
  1576. * The index of the mesh in this node
  1577. */
  1578. mesh?: number;
  1579. /**
  1580. * The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar
  1581. */
  1582. rotation?: number[];
  1583. /**
  1584. * The node's non-uniform scale, given as the scaling factors along the x, y, and z axes
  1585. */
  1586. scale?: number[];
  1587. /**
  1588. * The node's translation along the x, y, and z axes
  1589. */
  1590. translation?: number[];
  1591. /**
  1592. * The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh
  1593. */
  1594. weights?: number[];
  1595. }
  1596. /**
  1597. * Texture sampler properties for filtering and wrapping modes
  1598. */
  1599. interface ISampler extends IChildRootProperty {
  1600. /**
  1601. * Magnification filter. Valid values correspond to WebGL enums: 9728 (NEAREST) and 9729 (LINEAR)
  1602. */
  1603. magFilter?: TextureMagFilter;
  1604. /**
  1605. * Minification filter. All valid values correspond to WebGL enums
  1606. */
  1607. minFilter?: TextureMinFilter;
  1608. /**
  1609. * S (U) wrapping mode. All valid values correspond to WebGL enums
  1610. */
  1611. wrapS?: TextureWrapMode;
  1612. /**
  1613. * T (V) wrapping mode. All valid values correspond to WebGL enums
  1614. */
  1615. wrapT?: TextureWrapMode;
  1616. }
  1617. /**
  1618. * The root nodes of a scene
  1619. */
  1620. interface IScene extends IChildRootProperty {
  1621. /**
  1622. * The indices of each root node
  1623. */
  1624. nodes: number[];
  1625. }
  1626. /**
  1627. * Joints and matrices defining a skin
  1628. */
  1629. interface ISkin extends IChildRootProperty {
  1630. /**
  1631. * The index of the accessor containing the floating-point 4x4 inverse-bind matrices. The default is that each matrix is a 4x4 identity matrix, which implies that inverse-bind matrices were pre-applied
  1632. */
  1633. inverseBindMatrices?: number;
  1634. /**
  1635. * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root
  1636. */
  1637. skeleton?: number;
  1638. /**
  1639. * Indices of skeleton nodes, used as joints in this skin. The array length must be the same as the count property of the inverseBindMatrices accessor (when defined)
  1640. */
  1641. joints: number[];
  1642. }
  1643. /**
  1644. * A texture and its sampler
  1645. */
  1646. interface ITexture extends IChildRootProperty {
  1647. /**
  1648. * The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used
  1649. */
  1650. sampler?: number;
  1651. /**
  1652. * The index of the image used by this texture
  1653. */
  1654. source: number;
  1655. }
  1656. /**
  1657. * Reference to a texture
  1658. */
  1659. interface ITextureInfo extends IProperty {
  1660. /**
  1661. * The index of the texture
  1662. */
  1663. index: number;
  1664. /**
  1665. * The set index of texture's TEXCOORD attribute used for texture coordinate mapping
  1666. */
  1667. texCoord?: number;
  1668. }
  1669. /**
  1670. * The root object for a glTF asset
  1671. */
  1672. interface IGLTF extends IProperty {
  1673. /**
  1674. * An array of accessors. An accessor is a typed view into a bufferView
  1675. */
  1676. accessors?: IAccessor[];
  1677. /**
  1678. * An array of keyframe animations
  1679. */
  1680. animations?: IAnimation[];
  1681. /**
  1682. * Metadata about the glTF asset
  1683. */
  1684. asset: IAsset;
  1685. /**
  1686. * An array of buffers. A buffer points to binary geometry, animation, or skins
  1687. */
  1688. buffers?: IBuffer[];
  1689. /**
  1690. * An array of bufferViews. A bufferView is a view into a buffer generally representing a subset of the buffer
  1691. */
  1692. bufferViews?: IBufferView[];
  1693. /**
  1694. * An array of cameras
  1695. */
  1696. cameras?: ICamera[];
  1697. /**
  1698. * Names of glTF extensions used somewhere in this asset
  1699. */
  1700. extensionsUsed?: string[];
  1701. /**
  1702. * Names of glTF extensions required to properly load this asset
  1703. */
  1704. extensionsRequired?: string[];
  1705. /**
  1706. * An array of images. An image defines data used to create a texture
  1707. */
  1708. images?: IImage[];
  1709. /**
  1710. * An array of materials. A material defines the appearance of a primitive
  1711. */
  1712. materials?: IMaterial[];
  1713. /**
  1714. * An array of meshes. A mesh is a set of primitives to be rendered
  1715. */
  1716. meshes?: IMesh[];
  1717. /**
  1718. * An array of nodes
  1719. */
  1720. nodes?: INode[];
  1721. /**
  1722. * An array of samplers. A sampler contains properties for texture filtering and wrapping modes
  1723. */
  1724. samplers?: ISampler[];
  1725. /**
  1726. * The index of the default scene
  1727. */
  1728. scene?: number;
  1729. /**
  1730. * An array of scenes
  1731. */
  1732. scenes?: IScene[];
  1733. /**
  1734. * An array of skins. A skin is defined by joints and matrices
  1735. */
  1736. skins?: ISkin[];
  1737. /**
  1738. * An array of textures
  1739. */
  1740. textures?: ITexture[];
  1741. }
  1742. /**
  1743. * Interface for glTF validation results
  1744. */
  1745. interface IGLTFValidationResults {
  1746. info: {
  1747. generator: string;
  1748. hasAnimations: boolean;
  1749. hasDefaultScene: boolean;
  1750. hasMaterials: boolean;
  1751. hasMorphTargets: boolean;
  1752. hasSkins: boolean;
  1753. hasTextures: boolean;
  1754. maxAttributesUsed: number;
  1755. primitivesCount: number
  1756. };
  1757. issues: {
  1758. messages: Array<string>;
  1759. numErrors: number;
  1760. numHints: number;
  1761. numInfos: number;
  1762. numWarnings: number;
  1763. truncated: boolean
  1764. };
  1765. mimeType: string;
  1766. uri: string;
  1767. validatedAt: string;
  1768. validatorVersion: string;
  1769. }
  1770. /**
  1771. * Interface for glTF validation options
  1772. */
  1773. interface IGLTFValidationOptions {
  1774. uri?: string;
  1775. externalResourceFunction?: (uri: string) => Promise<Uint8Array>;
  1776. validateAccessorData?: boolean;
  1777. maxIssues?: number;
  1778. ignoredIssues?: Array<string>;
  1779. severityOverrides?: Object;
  1780. }
  1781. /**
  1782. * glTF validator object Tyyings
  1783. */
  1784. interface IGLTFValidatorTypings {
  1785. validateString: (json: string, options?: IGLTFValidationOptions) => Promise<IGLTFValidationResults>;
  1786. }
  1787. }
  1788. /**
  1789. * Interface for glTF validation results
  1790. */
  1791. interface IGLTFValidationResults {
  1792. info: {
  1793. generator: string;
  1794. hasAnimations: boolean;
  1795. hasDefaultScene: boolean;
  1796. hasMaterials: boolean;
  1797. hasMorphTargets: boolean;
  1798. hasSkins: boolean;
  1799. hasTextures: boolean;
  1800. maxAttributesUsed: number;
  1801. primitivesCount: number
  1802. };
  1803. issues: {
  1804. messages: Array<string>;
  1805. numErrors: number;
  1806. numHints: number;
  1807. numInfos: number;
  1808. numWarnings: number;
  1809. truncated: boolean
  1810. };
  1811. mimeType: string;
  1812. uri: string;
  1813. validatedAt: string;
  1814. validatorVersion: string;
  1815. }
  1816. /**
  1817. * Interface for glTF validation options
  1818. */
  1819. interface IGLTFValidationOptions {
  1820. uri?: string;
  1821. externalResourceFunction?: (uri: string) => Promise<Uint8Array>;
  1822. validateAccessorData?: boolean;
  1823. maxIssues?: number;
  1824. ignoredIssues?: Array<string>;
  1825. severityOverrides?: Object;
  1826. }
  1827. /**
  1828. * glTF validator object Tyyings
  1829. */
  1830. interface IGLTFValidatorTypings {
  1831. validateString: (json: string, options?: IGLTFValidationOptions) => Promise<IGLTFValidationResults>;
  1832. }