babylon.glTF2Interface.d.ts 33 KB

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