babylon.glTF2Interface.d.ts 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  1. /**
  2. * @ignoreChildren
  3. * @ignore
  4. */
  5. declare module "babylonjs-gltf2interface" {
  6. export = BABYLON.GLTF2;
  7. }
  8. /**
  9. * Module for glTF 2.0 Interface
  10. * @ignoreChildren
  11. * @ignore
  12. */
  13. declare module BABYLON.GLTF2 {
  14. /**
  15. * The datatype of the components in the attribute
  16. */
  17. const enum AccessorComponentType {
  18. /**
  19. * Byte
  20. */
  21. BYTE = 5120,
  22. /**
  23. * Unsigned Byte
  24. */
  25. UNSIGNED_BYTE = 5121,
  26. /**
  27. * Short
  28. */
  29. SHORT = 5122,
  30. /**
  31. * Unsigned Short
  32. */
  33. UNSIGNED_SHORT = 5123,
  34. /**
  35. * Unsigned Int
  36. */
  37. UNSIGNED_INT = 5125,
  38. /**
  39. * Float
  40. */
  41. FLOAT = 5126,
  42. }
  43. /**
  44. * Specifies if the attirbute is a scalar, vector, or matrix
  45. */
  46. const enum AccessorType {
  47. /**
  48. * Scalar
  49. */
  50. SCALAR = "SCALAR",
  51. /**
  52. * Vector2
  53. */
  54. VEC2 = "VEC2",
  55. /**
  56. * Vector3
  57. */
  58. VEC3 = "VEC3",
  59. /**
  60. * Vector4
  61. */
  62. VEC4 = "VEC4",
  63. /**
  64. * Matrix2x2
  65. */
  66. MAT2 = "MAT2",
  67. /**
  68. * Matrix3x3
  69. */
  70. MAT3 = "MAT3",
  71. /**
  72. * Matrix4x4
  73. */
  74. MAT4 = "MAT4",
  75. }
  76. /**
  77. * The name of the node's TRS property to modify, or the weights of the Morph Targets it instantiates
  78. */
  79. const enum AnimationChannelTargetPath {
  80. /**
  81. * Translation
  82. */
  83. TRANSLATION = "translation",
  84. /**
  85. * Rotation
  86. */
  87. ROTATION = "rotation",
  88. /**
  89. * Scale
  90. */
  91. SCALE = "scale",
  92. /**
  93. * Weights
  94. */
  95. WEIGHTS = "weights",
  96. }
  97. /**
  98. * Interpolation algorithm
  99. */
  100. const enum AnimationSamplerInterpolation {
  101. /**
  102. * The animated values are linearly interpolated between keyframes
  103. */
  104. LINEAR = "LINEAR",
  105. /**
  106. * The animated values remain constant to the output of the first keyframe, until the next keyframe
  107. */
  108. STEP = "STEP",
  109. /**
  110. * The animation's interpolation is computed using a cubic spline with specified tangents
  111. */
  112. CUBICSPLINE = "CUBICSPLINE",
  113. }
  114. /**
  115. * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene
  116. */
  117. const enum CameraType {
  118. /**
  119. * A perspective camera containing properties to create a perspective projection matrix
  120. */
  121. PERSPECTIVE = "perspective",
  122. /**
  123. * An orthographic camera containing properties to create an orthographic projection matrix
  124. */
  125. ORTHOGRAPHIC = "orthographic",
  126. }
  127. /**
  128. * The mime-type of the image
  129. */
  130. const enum ImageMimeType {
  131. /**
  132. * JPEG Mime-type
  133. */
  134. JPEG = "image/jpeg",
  135. /**
  136. * PNG Mime-type
  137. */
  138. PNG = "image/png",
  139. }
  140. /**
  141. * The alpha rendering mode of the material
  142. */
  143. const enum MaterialAlphaMode {
  144. /**
  145. * The alpha value is ignored and the rendered output is fully opaque
  146. */
  147. OPAQUE = "OPAQUE",
  148. /**
  149. * The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value
  150. */
  151. MASK = "MASK",
  152. /**
  153. * 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)
  154. */
  155. BLEND = "BLEND",
  156. }
  157. /**
  158. * The type of the primitives to render
  159. */
  160. const enum MeshPrimitiveMode {
  161. /**
  162. * Points
  163. */
  164. POINTS = 0,
  165. /**
  166. * Lines
  167. */
  168. LINES = 1,
  169. /**
  170. * Line Loop
  171. */
  172. LINE_LOOP = 2,
  173. /**
  174. * Line Strip
  175. */
  176. LINE_STRIP = 3,
  177. /**
  178. * Triangles
  179. */
  180. TRIANGLES = 4,
  181. /**
  182. * Triangle Strip
  183. */
  184. TRIANGLE_STRIP = 5,
  185. /**
  186. * Triangle Fan
  187. */
  188. TRIANGLE_FAN = 6,
  189. }
  190. /**
  191. * Magnification filter. Valid values correspond to WebGL enums: 9728 (NEAREST) and 9729 (LINEAR)
  192. */
  193. const enum TextureMagFilter {
  194. /**
  195. * Nearest
  196. */
  197. NEAREST = 9728,
  198. /**
  199. * Linear
  200. */
  201. LINEAR = 9729,
  202. }
  203. /**
  204. * Minification filter. All valid values correspond to WebGL enums
  205. */
  206. const enum TextureMinFilter {
  207. /**
  208. * Nearest
  209. */
  210. NEAREST = 9728,
  211. /**
  212. * Linear
  213. */
  214. LINEAR = 9729,
  215. /**
  216. * Nearest Mip-Map Nearest
  217. */
  218. NEAREST_MIPMAP_NEAREST = 9984,
  219. /**
  220. * Linear Mipmap Nearest
  221. */
  222. LINEAR_MIPMAP_NEAREST = 9985,
  223. /**
  224. * Nearest Mipmap Linear
  225. */
  226. NEAREST_MIPMAP_LINEAR = 9986,
  227. /**
  228. * Linear Mipmap Linear
  229. */
  230. LINEAR_MIPMAP_LINEAR = 9987,
  231. }
  232. /**
  233. * S (U) wrapping mode. All valid values correspond to WebGL enums
  234. */
  235. const enum TextureWrapMode {
  236. /**
  237. * Clamp to Edge
  238. */
  239. CLAMP_TO_EDGE = 33071,
  240. /**
  241. * Mirrored Repeat
  242. */
  243. MIRRORED_REPEAT = 33648,
  244. /**
  245. * Repeat
  246. */
  247. REPEAT = 10497,
  248. }
  249. /**
  250. * glTF Property
  251. */
  252. interface IProperty {
  253. /**
  254. * Dictionary object with extension-specific objects
  255. */
  256. extensions?: {
  257. [key: string]: any;
  258. };
  259. /**
  260. * Application-Specific data
  261. */
  262. extras?: any;
  263. }
  264. /**
  265. * glTF Child of Root Property
  266. */
  267. interface IChildRootProperty extends IProperty {
  268. /**
  269. * The user-defined name of this object
  270. */
  271. name?: string;
  272. }
  273. /**
  274. * Indices of those attributes that deviate from their initialization value
  275. */
  276. interface IAccessorSparseIndices extends IProperty {
  277. /**
  278. * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target
  279. */
  280. bufferView: number;
  281. /**
  282. * The offset relative to the start of the bufferView in bytes. Must be aligned
  283. */
  284. byteOffset?: number;
  285. /**
  286. * The indices data type. Valid values correspond to WebGL enums: 5121 (UNSIGNED_BYTE), 5123 (UNSIGNED_SHORT), 5125 (UNSIGNED_INT)
  287. */
  288. componentType: AccessorComponentType;
  289. }
  290. /**
  291. * Array of size accessor.sparse.count times number of components storing the displaced accessor attributes pointed by accessor.sparse.indices
  292. */
  293. interface IAccessorSparseValues extends IProperty {
  294. /**
  295. * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target
  296. */
  297. bufferView: number;
  298. /**
  299. * The offset relative to the start of the bufferView in bytes. Must be aligned
  300. */
  301. byteOffset?: number;
  302. }
  303. /**
  304. * Sparse storage of attributes that deviate from their initialization value
  305. */
  306. interface IAccessorSparse extends IProperty {
  307. /**
  308. * The number of attributes encoded in this sparse accessor
  309. */
  310. count: number;
  311. /**
  312. * Index array of size count that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase
  313. */
  314. indices: IAccessorSparseIndices;
  315. /**
  316. * 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
  317. */
  318. values: IAccessorSparseValues;
  319. }
  320. /**
  321. * 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
  322. */
  323. interface IAccessor extends IChildRootProperty {
  324. /**
  325. * The index of the bufferview
  326. */
  327. bufferView?: number;
  328. /**
  329. * The offset relative to the start of the bufferView in bytes
  330. */
  331. byteOffset?: number;
  332. /**
  333. * The datatype of components in the attribute
  334. */
  335. componentType: AccessorComponentType;
  336. /**
  337. * Specifies whether integer data values should be normalized
  338. */
  339. normalized?: boolean;
  340. /**
  341. * The number of attributes referenced by this accessor
  342. */
  343. count: number;
  344. /**
  345. * Specifies if the attribute is a scalar, vector, or matrix
  346. */
  347. type: AccessorType;
  348. /**
  349. * Maximum value of each component in this attribute
  350. */
  351. max?: number[];
  352. /**
  353. * Minimum value of each component in this attribute
  354. */
  355. min?: number[];
  356. /**
  357. * Sparse storage of attributes that deviate from their initialization value
  358. */
  359. sparse?: IAccessorSparse;
  360. }
  361. /**
  362. * Targets an animation's sampler at a node's property
  363. */
  364. interface IAnimationChannel extends IProperty {
  365. /**
  366. * The index of a sampler in this animation used to compute the value for the target
  367. */
  368. sampler: number;
  369. /**
  370. * The index of the node and TRS property to target
  371. */
  372. target: IAnimationChannelTarget;
  373. }
  374. /**
  375. * The index of the node and TRS property that an animation channel targets
  376. */
  377. interface IAnimationChannelTarget extends IProperty {
  378. /**
  379. * The index of the node to target
  380. */
  381. node: number;
  382. /**
  383. * The name of the node's TRS property to modify, or the weights of the Morph Targets it instantiates
  384. */
  385. path: AnimationChannelTargetPath;
  386. }
  387. /**
  388. * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)
  389. */
  390. interface IAnimationSampler extends IProperty {
  391. /**
  392. * The index of an accessor containing keyframe input values, e.g., time
  393. */
  394. input: number;
  395. /**
  396. * Interpolation algorithm
  397. */
  398. interpolation?: AnimationSamplerInterpolation;
  399. /**
  400. * The index of an accessor, containing keyframe output values
  401. */
  402. output: number;
  403. }
  404. /**
  405. * A keyframe animation
  406. */
  407. interface IAnimation extends IChildRootProperty {
  408. /**
  409. * An array of channels, each of which targets an animation's sampler at a node's property
  410. */
  411. channels: IAnimationChannel[];
  412. /**
  413. * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target)
  414. */
  415. samplers: IAnimationSampler[];
  416. }
  417. /**
  418. * Metadata about the glTF asset
  419. */
  420. interface IAsset extends IChildRootProperty {
  421. /**
  422. * A copyright message suitable for display to credit the content creator
  423. */
  424. copyright?: string;
  425. /**
  426. * Tool that generated this glTF model. Useful for debugging
  427. */
  428. generator?: string;
  429. /**
  430. * The glTF version that this asset targets
  431. */
  432. version: string;
  433. /**
  434. * The minimum glTF version that this asset targets
  435. */
  436. minVersion?: string;
  437. }
  438. /**
  439. * A buffer points to binary geometry, animation, or skins
  440. */
  441. interface IBuffer extends IChildRootProperty {
  442. /**
  443. * 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
  444. */
  445. uri?: string;
  446. /**
  447. * The length of the buffer in bytes
  448. */
  449. byteLength: number;
  450. }
  451. /**
  452. * A view into a buffer generally representing a subset of the buffer
  453. */
  454. interface IBufferView extends IChildRootProperty {
  455. /**
  456. * The index of the buffer
  457. */
  458. buffer: number;
  459. /**
  460. * The offset into the buffer in bytes
  461. */
  462. byteOffset?: number;
  463. /**
  464. * The lenth of the bufferView in bytes
  465. */
  466. byteLength: number;
  467. /**
  468. * The stride, in bytes
  469. */
  470. byteStride?: number;
  471. }
  472. /**
  473. * An orthographic camera containing properties to create an orthographic projection matrix
  474. */
  475. interface ICameraOrthographic extends IProperty {
  476. /**
  477. * The floating-point horizontal magnification of the view. Must not be zero
  478. */
  479. xmag: number;
  480. /**
  481. * The floating-point vertical magnification of the view. Must not be zero
  482. */
  483. ymag: number;
  484. /**
  485. * The floating-point distance to the far clipping plane. zfar must be greater than znear
  486. */
  487. zfar: number;
  488. /**
  489. * The floating-point distance to the near clipping plane
  490. */
  491. znear: number;
  492. }
  493. /**
  494. * A perspective camera containing properties to create a perspective projection matrix
  495. */
  496. interface ICameraPerspective extends IProperty {
  497. /**
  498. * The floating-point aspect ratio of the field of view
  499. */
  500. aspectRatio?: number;
  501. /**
  502. * The floating-point vertical field of view in radians
  503. */
  504. yfov: number;
  505. /**
  506. * The floating-point distance to the far clipping plane
  507. */
  508. zfar?: number;
  509. /**
  510. * The floating-point distance to the near clipping plane
  511. */
  512. znear: number;
  513. }
  514. /**
  515. * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene
  516. */
  517. interface ICamera extends IChildRootProperty {
  518. /**
  519. * An orthographic camera containing properties to create an orthographic projection matrix
  520. */
  521. orthographic?: ICameraOrthographic;
  522. /**
  523. * A perspective camera containing properties to create a perspective projection matrix
  524. */
  525. perspective?: ICameraPerspective;
  526. /**
  527. * Specifies if the camera uses a perspective or orthographic projection
  528. */
  529. type: CameraType;
  530. }
  531. /**
  532. * Image data used to create a texture. Image can be referenced by URI or bufferView index. mimeType is required in the latter case
  533. */
  534. interface IImage extends IChildRootProperty {
  535. /**
  536. * 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
  537. */
  538. uri?: string;
  539. /**
  540. * The image's MIME type
  541. */
  542. mimeType?: ImageMimeType;
  543. /**
  544. * The index of the bufferView that contains the image. Use this instead of the image's uri property
  545. */
  546. bufferView?: number;
  547. }
  548. /**
  549. * Material Normal Texture Info
  550. */
  551. interface IMaterialNormalTextureInfo extends ITextureInfo {
  552. /**
  553. * The scalar multiplier applied to each normal vector of the normal texture
  554. */
  555. scale?: number;
  556. }
  557. /**
  558. * Material Occlusion Texture Info
  559. */
  560. interface IMaterialOcclusionTextureInfo extends ITextureInfo {
  561. /**
  562. * A scalar multiplier controlling the amount of occlusion applied
  563. */
  564. strength?: number;
  565. }
  566. /**
  567. * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology
  568. */
  569. interface IMaterialPbrMetallicRoughness {
  570. /**
  571. * The material's base color factor
  572. */
  573. baseColorFactor?: number[];
  574. /**
  575. * The base color texture
  576. */
  577. baseColorTexture?: ITextureInfo;
  578. /**
  579. * The metalness of the material
  580. */
  581. metallicFactor?: number;
  582. /**
  583. * The roughness of the material
  584. */
  585. roughnessFactor?: number;
  586. /**
  587. * The metallic-roughness texture
  588. */
  589. metallicRoughnessTexture?: ITextureInfo;
  590. }
  591. /**
  592. * The material appearance of a primitive
  593. */
  594. interface IMaterial extends IChildRootProperty {
  595. /**
  596. * 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
  597. */
  598. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  599. /**
  600. * The normal map texture
  601. */
  602. normalTexture?: IMaterialNormalTextureInfo;
  603. /**
  604. * The occlusion map texture
  605. */
  606. occlusionTexture?: IMaterialOcclusionTextureInfo;
  607. /**
  608. * The emissive map texture
  609. */
  610. emissiveTexture?: ITextureInfo;
  611. /**
  612. * 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
  613. */
  614. emissiveFactor?: number[];
  615. /**
  616. * The alpha rendering mode of the material
  617. */
  618. alphaMode?: MaterialAlphaMode;
  619. /**
  620. * The alpha cutoff value of the material
  621. */
  622. alphaCutoff?: number;
  623. /**
  624. * Specifies whether the material is double sided
  625. */
  626. doubleSided?: boolean;
  627. }
  628. /**
  629. * Geometry to be rendered with the given material
  630. */
  631. interface IMeshPrimitive extends IProperty {
  632. /**
  633. * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data
  634. */
  635. attributes: {
  636. [name: string]: number;
  637. };
  638. /**
  639. * The index of the accessor that contains the indices
  640. */
  641. indices?: number;
  642. /**
  643. * The index of the material to apply to this primitive when rendering
  644. */
  645. material?: number;
  646. /**
  647. * The type of primitives to render. All valid values correspond to WebGL enums
  648. */
  649. mode?: MeshPrimitiveMode;
  650. /**
  651. * 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
  652. */
  653. targets?: {
  654. [name: string]: number;
  655. }[];
  656. }
  657. /**
  658. * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene
  659. */
  660. interface IMesh extends IChildRootProperty {
  661. /**
  662. * An array of primitives, each defining geometry to be rendered with a material
  663. */
  664. primitives: IMeshPrimitive[];
  665. /**
  666. * Array of weights to be applied to the Morph Targets
  667. */
  668. weights?: number[];
  669. }
  670. /**
  671. * A node in the node hierarchy
  672. */
  673. interface INode extends IChildRootProperty {
  674. /**
  675. * The index of the camera referenced by this node
  676. */
  677. camera?: number;
  678. /**
  679. * The indices of this node's children
  680. */
  681. children?: number[];
  682. /**
  683. * The index of the skin referenced by this node
  684. */
  685. skin?: number;
  686. /**
  687. * A floating-point 4x4 transformation matrix stored in column-major order
  688. */
  689. matrix?: number[];
  690. /**
  691. * The index of the mesh in this node
  692. */
  693. mesh?: number;
  694. /**
  695. * The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar
  696. */
  697. rotation?: number[];
  698. /**
  699. * The node's non-uniform scale, given as the scaling factors along the x, y, and z axes
  700. */
  701. scale?: number[];
  702. /**
  703. * The node's translation along the x, y, and z axes
  704. */
  705. translation?: number[];
  706. /**
  707. * The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh
  708. */
  709. weights?: number[];
  710. }
  711. /**
  712. * Texture sampler properties for filtering and wrapping modes
  713. */
  714. interface ISampler extends IChildRootProperty {
  715. /**
  716. * Magnification filter. Valid values correspond to WebGL enums: 9728 (NEAREST) and 9729 (LINEAR)
  717. */
  718. magFilter?: TextureMagFilter;
  719. /**
  720. * Minification filter. All valid values correspond to WebGL enums
  721. */
  722. minFilter?: TextureMinFilter;
  723. /**
  724. * S (U) wrapping mode. All valid values correspond to WebGL enums
  725. */
  726. wrapS?: TextureWrapMode;
  727. /**
  728. * T (V) wrapping mode. All valid values correspond to WebGL enums
  729. */
  730. wrapT?: TextureWrapMode;
  731. }
  732. /**
  733. * The root nodes of a scene
  734. */
  735. interface IScene extends IChildRootProperty {
  736. /**
  737. * The indices of each root node
  738. */
  739. nodes: number[];
  740. }
  741. /**
  742. * Joints and matrices defining a skin
  743. */
  744. interface ISkin extends IChildRootProperty {
  745. /**
  746. * 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
  747. */
  748. inverseBindMatrices?: number;
  749. /**
  750. * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root
  751. */
  752. skeleton?: number;
  753. /**
  754. * 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)
  755. */
  756. joints: number[];
  757. }
  758. /**
  759. * A texture and its sampler
  760. */
  761. interface ITexture extends IChildRootProperty {
  762. /**
  763. * The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used
  764. */
  765. sampler?: number;
  766. /**
  767. * The index of the image used by this texture
  768. */
  769. source: number;
  770. }
  771. /**
  772. * Reference to a texture
  773. */
  774. interface ITextureInfo extends IProperty {
  775. /**
  776. * The index of the texture
  777. */
  778. index: number;
  779. /**
  780. * The set index of texture's TEXCOORD attribute used for texture coordinate mapping
  781. */
  782. texCoord?: number;
  783. }
  784. /**
  785. * The root object for a glTF asset
  786. */
  787. interface IGLTF extends IProperty {
  788. /**
  789. * An array of accessors. An accessor is a typed view into a bufferView
  790. */
  791. accessors?: IAccessor[];
  792. /**
  793. * An array of keyframe animations
  794. */
  795. animations?: IAnimation[];
  796. /**
  797. * Metadata about the glTF asset
  798. */
  799. asset: IAsset;
  800. /**
  801. * An array of buffers. A buffer points to binary geometry, animation, or skins
  802. */
  803. buffers?: IBuffer[];
  804. /**
  805. * An array of bufferViews. A bufferView is a view into a buffer generally representing a subset of the buffer
  806. */
  807. bufferViews?: IBufferView[];
  808. /**
  809. * An array of cameras
  810. */
  811. cameras?: ICamera[];
  812. /**
  813. * Names of glTF extensions used somewhere in this asset
  814. */
  815. extensionsUsed?: string[];
  816. /**
  817. * Names of glTF extensions required to properly load this asset
  818. */
  819. extensionsRequired?: string[];
  820. /**
  821. * An array of images. An image defines data used to create a texture
  822. */
  823. images?: IImage[];
  824. /**
  825. * An array of materials. A material defines the appearance of a primitive
  826. */
  827. materials?: IMaterial[];
  828. /**
  829. * An array of meshes. A mesh is a set of primitives to be rendered
  830. */
  831. meshes?: IMesh[];
  832. /**
  833. * An array of nodes
  834. */
  835. nodes?: INode[];
  836. /**
  837. * An array of samplers. A sampler contains properties for texture filtering and wrapping modes
  838. */
  839. samplers?: ISampler[];
  840. /**
  841. * The index of the default scene
  842. */
  843. scene?: number;
  844. /**
  845. * An array of scenes
  846. */
  847. scenes?: IScene[];
  848. /**
  849. * An array of skins. A skin is defined by joints and matrices
  850. */
  851. skins?: ISkin[];
  852. /**
  853. * An array of textures
  854. */
  855. textures?: ITexture[];
  856. }
  857. /**
  858. * Interface for glTF validation results
  859. */
  860. interface IGLTFValidationResults {
  861. info: {
  862. generator: string;
  863. hasAnimations: boolean;
  864. hasDefaultScene: boolean;
  865. hasMaterials: boolean;
  866. hasMorphTargets: boolean;
  867. hasSkins: boolean;
  868. hasTextures: boolean;
  869. maxAttributesUsed: number;
  870. primitivesCount: number
  871. };
  872. issues: {
  873. messages: Array<string>;
  874. numErrors: number;
  875. numHints: number;
  876. numInfos: number;
  877. numWarnings: number;
  878. truncated: boolean
  879. };
  880. mimeType: string;
  881. uri: string;
  882. validatedAt: string;
  883. validatorVersion: string;
  884. }
  885. /**
  886. * Interface for glTF validation options
  887. */
  888. interface IGLTFValidationOptions {
  889. uri?: string;
  890. externalResourceFunction?: (uri: string) => Promise<Uint8Array>;
  891. validateAccessorData?: boolean;
  892. maxIssues?: number;
  893. ignoredIssues?: Array<string>;
  894. severityOverrides?: Object;
  895. }
  896. /**
  897. * glTF validator object Tyyings
  898. */
  899. interface IGLTFValidatorTypings {
  900. validateString: (json: string, options?: IGLTFValidationOptions) => Promise<IGLTFValidationResults>;
  901. }
  902. }
  903. /**
  904. * Interface for glTF validation results
  905. */
  906. interface IGLTFValidationResults {
  907. info: {
  908. generator: string;
  909. hasAnimations: boolean;
  910. hasDefaultScene: boolean;
  911. hasMaterials: boolean;
  912. hasMorphTargets: boolean;
  913. hasSkins: boolean;
  914. hasTextures: boolean;
  915. maxAttributesUsed: number;
  916. primitivesCount: number
  917. };
  918. issues: {
  919. messages: Array<string>;
  920. numErrors: number;
  921. numHints: number;
  922. numInfos: number;
  923. numWarnings: number;
  924. truncated: boolean
  925. };
  926. mimeType: string;
  927. uri: string;
  928. validatedAt: string;
  929. validatorVersion: string;
  930. }
  931. /**
  932. * Interface for glTF validation options
  933. */
  934. interface IGLTFValidationOptions {
  935. uri?: string;
  936. externalResourceFunction?: (uri: string) => Promise<Uint8Array>;
  937. validateAccessorData?: boolean;
  938. maxIssues?: number;
  939. ignoredIssues?: Array<string>;
  940. severityOverrides?: Object;
  941. }
  942. /**
  943. * glTF validator object Tyyings
  944. */
  945. interface IGLTFValidatorTypings {
  946. validateString: (json: string, options?: IGLTFValidationOptions) => Promise<IGLTFValidationResults>;
  947. }