@loaders.gl/gltf 4.0.0-alpha.6 → 4.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/dist.min.js +1415 -1339
  2. package/dist/es5/glb-loader.js +2 -2
  3. package/dist/es5/glb-loader.js.map +1 -1
  4. package/dist/es5/glb-writer.js +3 -4
  5. package/dist/es5/glb-writer.js.map +1 -1
  6. package/dist/es5/gltf-loader.js +3 -3
  7. package/dist/es5/gltf-loader.js.map +1 -1
  8. package/dist/es5/index.js +9 -3
  9. package/dist/es5/index.js.map +1 -1
  10. package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
  11. package/dist/es5/lib/api/gltf-scenegraph.js +47 -30
  12. package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -1
  13. package/dist/es5/lib/api/post-process-gltf.js +164 -116
  14. package/dist/es5/lib/api/post-process-gltf.js.map +1 -1
  15. package/dist/es5/lib/encoders/encode-glb.js +1 -1
  16. package/dist/es5/lib/encoders/encode-glb.js.map +1 -1
  17. package/dist/es5/lib/encoders/encode-gltf.js +2 -3
  18. package/dist/es5/lib/encoders/encode-gltf.js.map +1 -1
  19. package/dist/es5/lib/extensions/EXT_meshopt_compression.js +3 -5
  20. package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -1
  21. package/dist/es5/lib/extensions/EXT_texture_webp.js +2 -3
  22. package/dist/es5/lib/extensions/EXT_texture_webp.js.map +1 -1
  23. package/dist/es5/lib/extensions/KHR_binary_gltf.js +2 -3
  24. package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -1
  25. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +6 -5
  26. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
  27. package/dist/es5/lib/extensions/KHR_texture_basisu.js +3 -4
  28. package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +1 -1
  29. package/dist/es5/lib/extensions/KHR_texture_transform.js +9 -8
  30. package/dist/es5/lib/extensions/KHR_texture_transform.js.map +1 -1
  31. package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +2 -2
  32. package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
  33. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +3 -3
  34. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
  35. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +3 -3
  36. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
  37. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +2 -2
  38. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
  39. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
  40. package/dist/es5/lib/gltf-utils/gltf-utils.js +24 -0
  41. package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -1
  42. package/dist/es5/lib/parsers/parse-glb.js +10 -10
  43. package/dist/es5/lib/parsers/parse-glb.js.map +1 -1
  44. package/dist/es5/lib/parsers/parse-gltf.js +6 -10
  45. package/dist/es5/lib/parsers/parse-gltf.js.map +1 -1
  46. package/dist/es5/lib/types/gltf-json-schema.js.map +1 -1
  47. package/dist/es5/lib/types/gltf-postprocessed-schema.js.map +1 -1
  48. package/dist/es5/lib/types/gltf-types.js.map +1 -1
  49. package/dist/es5/lib/utils/version.js +1 -1
  50. package/dist/esm/glb-loader.js +1 -1
  51. package/dist/esm/glb-loader.js.map +1 -1
  52. package/dist/esm/glb-writer.js +1 -1
  53. package/dist/esm/glb-writer.js.map +1 -1
  54. package/dist/esm/gltf-loader.js +3 -3
  55. package/dist/esm/gltf-loader.js.map +1 -1
  56. package/dist/esm/index.js +2 -1
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/lib/api/gltf-extensions.js.map +1 -1
  59. package/dist/esm/lib/api/gltf-scenegraph.js +40 -29
  60. package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -1
  61. package/dist/esm/lib/api/post-process-gltf.js +167 -112
  62. package/dist/esm/lib/api/post-process-gltf.js.map +1 -1
  63. package/dist/esm/lib/encoders/encode-glb.js +1 -1
  64. package/dist/esm/lib/encoders/encode-glb.js.map +1 -1
  65. package/dist/esm/lib/encoders/encode-gltf.js +1 -1
  66. package/dist/esm/lib/encoders/encode-gltf.js.map +1 -1
  67. package/dist/esm/lib/extensions/EXT_meshopt_compression.js +2 -3
  68. package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +1 -1
  69. package/dist/esm/lib/extensions/EXT_texture_webp.js +1 -1
  70. package/dist/esm/lib/extensions/EXT_texture_webp.js.map +1 -1
  71. package/dist/esm/lib/extensions/KHR_binary_gltf.js +1 -1
  72. package/dist/esm/lib/extensions/KHR_binary_gltf.js.map +1 -1
  73. package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js +5 -4
  74. package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
  75. package/dist/esm/lib/extensions/KHR_texture_basisu.js +2 -2
  76. package/dist/esm/lib/extensions/KHR_texture_basisu.js.map +1 -1
  77. package/dist/esm/lib/extensions/KHR_texture_transform.js +7 -6
  78. package/dist/esm/lib/extensions/KHR_texture_transform.js.map +1 -1
  79. package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +1 -1
  80. package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
  81. package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js +1 -1
  82. package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
  83. package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js +1 -1
  84. package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
  85. package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js +1 -1
  86. package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
  87. package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
  88. package/dist/esm/lib/gltf-utils/gltf-utils.js +20 -0
  89. package/dist/esm/lib/gltf-utils/gltf-utils.js.map +1 -1
  90. package/dist/esm/lib/parsers/parse-glb.js +10 -10
  91. package/dist/esm/lib/parsers/parse-glb.js.map +1 -1
  92. package/dist/esm/lib/parsers/parse-gltf.js +5 -6
  93. package/dist/esm/lib/parsers/parse-gltf.js.map +1 -1
  94. package/dist/esm/lib/types/gltf-json-schema.js.map +1 -1
  95. package/dist/esm/lib/types/gltf-postprocessed-schema.js.map +1 -1
  96. package/dist/esm/lib/types/gltf-types.js.map +1 -1
  97. package/dist/esm/lib/utils/version.js +1 -1
  98. package/dist/glb-loader.d.ts +2 -2
  99. package/dist/glb-loader.js +2 -5
  100. package/dist/glb-writer.d.ts.map +1 -1
  101. package/dist/glb-writer.js +4 -6
  102. package/dist/gltf-loader.d.ts +5 -5
  103. package/dist/gltf-loader.d.ts.map +1 -1
  104. package/dist/gltf-loader.js +3 -3
  105. package/dist/index.d.ts +8 -5
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +12 -5
  108. package/dist/lib/api/gltf-extensions.d.ts +1 -1
  109. package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
  110. package/dist/lib/api/gltf-scenegraph.d.ts +6 -4
  111. package/dist/lib/api/gltf-scenegraph.d.ts.map +1 -1
  112. package/dist/lib/api/gltf-scenegraph.js +43 -30
  113. package/dist/lib/api/post-process-gltf.d.ts +4 -1
  114. package/dist/lib/api/post-process-gltf.d.ts.map +1 -1
  115. package/dist/lib/api/post-process-gltf.js +186 -123
  116. package/dist/lib/encoders/encode-glb.d.ts +13 -1
  117. package/dist/lib/encoders/encode-glb.d.ts.map +1 -1
  118. package/dist/lib/encoders/encode-glb.js +15 -4
  119. package/dist/lib/encoders/encode-gltf.js +2 -5
  120. package/dist/lib/extensions/EXT_meshopt_compression.d.ts +1 -1
  121. package/dist/lib/extensions/EXT_meshopt_compression.d.ts.map +1 -1
  122. package/dist/lib/extensions/EXT_meshopt_compression.js +3 -7
  123. package/dist/lib/extensions/EXT_texture_webp.d.ts +1 -1
  124. package/dist/lib/extensions/EXT_texture_webp.d.ts.map +1 -1
  125. package/dist/lib/extensions/EXT_texture_webp.js +2 -5
  126. package/dist/lib/extensions/KHR_binary_gltf.d.ts +1 -1
  127. package/dist/lib/extensions/KHR_binary_gltf.d.ts.map +1 -1
  128. package/dist/lib/extensions/KHR_binary_gltf.js +2 -5
  129. package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts +1 -1
  130. package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts.map +1 -1
  131. package/dist/lib/extensions/KHR_draco_mesh_compression.js +5 -8
  132. package/dist/lib/extensions/KHR_texture_basisu.d.ts +1 -1
  133. package/dist/lib/extensions/KHR_texture_basisu.d.ts.map +1 -1
  134. package/dist/lib/extensions/KHR_texture_basisu.js +3 -6
  135. package/dist/lib/extensions/KHR_texture_transform.d.ts.map +1 -1
  136. package/dist/lib/extensions/KHR_texture_transform.js +7 -10
  137. package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts +1 -1
  138. package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -1
  139. package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +2 -5
  140. package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts +1 -1
  141. package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts.map +1 -1
  142. package/dist/lib/extensions/deprecated/KHR_lights_punctual.js +3 -6
  143. package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts +1 -1
  144. package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts.map +1 -1
  145. package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +3 -6
  146. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts +1 -1
  147. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts.map +1 -1
  148. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +2 -5
  149. package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts +1 -1
  150. package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts.map +1 -1
  151. package/dist/lib/gltf-utils/gltf-utils.d.ts +7 -0
  152. package/dist/lib/gltf-utils/gltf-utils.d.ts.map +1 -1
  153. package/dist/lib/gltf-utils/gltf-utils.js +28 -1
  154. package/dist/lib/parsers/parse-glb.d.ts +15 -3
  155. package/dist/lib/parsers/parse-glb.d.ts.map +1 -1
  156. package/dist/lib/parsers/parse-glb.js +43 -18
  157. package/dist/lib/parsers/parse-gltf.d.ts +8 -4
  158. package/dist/lib/parsers/parse-gltf.d.ts.map +1 -1
  159. package/dist/lib/parsers/parse-gltf.js +13 -34
  160. package/dist/lib/types/gltf-json-schema.d.ts +151 -138
  161. package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
  162. package/dist/lib/types/gltf-postprocessed-schema.d.ts +174 -209
  163. package/dist/lib/types/gltf-postprocessed-schema.d.ts.map +1 -1
  164. package/dist/lib/types/gltf-postprocessed-schema.js +1 -1
  165. package/dist/lib/types/gltf-types.d.ts +18 -6
  166. package/dist/lib/types/gltf-types.d.ts.map +1 -1
  167. package/package.json +6 -6
  168. package/src/glb-loader.ts +3 -3
  169. package/src/glb-writer.ts +3 -1
  170. package/src/gltf-loader.ts +12 -8
  171. package/src/index.ts +32 -13
  172. package/src/lib/api/gltf-extensions.ts +1 -1
  173. package/src/lib/api/gltf-scenegraph.ts +55 -37
  174. package/src/lib/api/post-process-gltf.ts +275 -150
  175. package/src/lib/encoders/encode-glb.ts +15 -5
  176. package/src/lib/encoders/encode-gltf.ts +1 -1
  177. package/src/lib/extensions/EXT_meshopt_compression.ts +4 -6
  178. package/src/lib/extensions/EXT_texture_webp.ts +2 -2
  179. package/src/lib/extensions/KHR_binary_gltf.ts +2 -2
  180. package/src/lib/extensions/KHR_draco_mesh_compression.ts +7 -7
  181. package/src/lib/extensions/KHR_texture_basisu.ts +3 -3
  182. package/src/lib/extensions/KHR_texture_transform.ts +22 -19
  183. package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +2 -2
  184. package/src/lib/extensions/deprecated/KHR_lights_punctual.ts +2 -2
  185. package/src/lib/extensions/deprecated/KHR_materials_unlit.ts +2 -2
  186. package/src/lib/extensions/deprecated/KHR_techniques_webgl.ts +2 -2
  187. package/src/lib/gltf-utils/gltf-attribute-utils.ts +1 -1
  188. package/src/lib/gltf-utils/gltf-utils.ts +31 -0
  189. package/src/lib/parsers/parse-glb.ts +50 -24
  190. package/src/lib/parsers/parse-gltf.ts +22 -16
  191. package/src/lib/types/gltf-json-schema.ts +165 -138
  192. package/src/lib/types/gltf-postprocessed-schema.ts +289 -212
  193. package/src/lib/types/gltf-types.ts +35 -59
@@ -6,7 +6,7 @@ export type GLTFId = number;
6
6
  /**
7
7
  * Indices of those attributes that deviate from their initialization value.
8
8
  */
9
- export interface AccessorSparseIndices {
9
+ export type GLTFAccessorSparseIndices = {
10
10
  /**
11
11
  * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.
12
12
  */
@@ -19,15 +19,15 @@ export interface AccessorSparseIndices {
19
19
  * The indices data type.
20
20
  */
21
21
  componentType: 5121 | 5123 | 5125 | number;
22
- extensions?: any;
22
+ extensions?: Record<string, any>;
23
23
  extras?: any;
24
24
  // [k: string]: any;
25
- }
25
+ };
26
26
 
27
27
  /**
28
28
  * Array of size `accessor.sparse.count` times number of components storing the displaced accessor attributes pointed by `accessor.sparse.indices`.
29
29
  */
30
- export interface AccessorSparseValues {
30
+ export type GLTFAccessorSparseValues = {
31
31
  /**
32
32
  * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.
33
33
  */
@@ -36,15 +36,15 @@ export interface AccessorSparseValues {
36
36
  * The offset relative to the start of the bufferView in bytes. Must be aligned.
37
37
  */
38
38
  byteOffset?: number;
39
- extensions?: any;
39
+ extensions?: Record<string, any>;
40
40
  extras?: any;
41
41
  // [k: string]: any;
42
- }
42
+ };
43
43
 
44
44
  /**
45
45
  * Sparse storage of attributes that deviate from their initialization value.
46
46
  */
47
- export interface AccessorSparse {
47
+ export type GLTFAccessorSparse = {
48
48
  /**
49
49
  * Number of entries stored in the sparse array.
50
50
  */
@@ -52,20 +52,20 @@ export interface AccessorSparse {
52
52
  /**
53
53
  * Index array of size `count` that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase.
54
54
  */
55
- indices: AccessorSparseIndices;
55
+ indices: GLTFAccessorSparseIndices;
56
56
  /**
57
57
  * 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.
58
58
  */
59
- values: AccessorSparseValues;
60
- extensions?: any;
59
+ values: GLTFAccessorSparseValues;
60
+ extensions?: Record<string, any>;
61
61
  extras?: any;
62
62
  // [k: string]: any;
63
- }
63
+ };
64
64
 
65
65
  /**
66
66
  * 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.
67
67
  */
68
- export interface Accessor {
68
+ export type GLTFAccessor = {
69
69
  /**
70
70
  * The index of the bufferView.
71
71
  */
@@ -101,17 +101,17 @@ export interface Accessor {
101
101
  /**
102
102
  * Sparse storage of attributes that deviate from their initialization value.
103
103
  */
104
- sparse?: AccessorSparse;
104
+ sparse?: GLTFAccessorSparse;
105
105
  name?: any;
106
- extensions?: any;
106
+ extensions?: Record<string, any>;
107
107
  extras?: any;
108
108
  // [k: string]: any;
109
- }
109
+ };
110
110
 
111
111
  /**
112
112
  * The index of the node and TRS property that an animation channel targets.
113
113
  */
114
- export interface AnimationChannelTarget {
114
+ export type GLTFAnimationChannelTarget = {
115
115
  /**
116
116
  * The index of the node to target.
117
117
  */
@@ -120,15 +120,15 @@ export interface AnimationChannelTarget {
120
120
  * The name of the node's TRS property to modify, or the "weights" of the Morph Targets it instantiates. For the "translation" property, the values that are provided by the sampler are the translation along the x, y, and z axes. For the "rotation" property, the values are a quaternion in the order (x, y, z, w), where w is the scalar. For the "scale" property, the values are the scaling factors along the x, y, and z axes.
121
121
  */
122
122
  path: 'translation' | 'rotation' | 'scale' | 'weights' | string;
123
- extensions?: any;
123
+ extensions?: Record<string, any>;
124
124
  extras?: any;
125
125
  // [k: string]: any;
126
- }
126
+ };
127
127
 
128
128
  /**
129
129
  * Targets an animation's sampler at a node's property.
130
130
  */
131
- export interface AnimationChannel {
131
+ export type GLTFAnimationChannel = {
132
132
  /**
133
133
  * The index of a sampler in this animation used to compute the value for the target.
134
134
  */
@@ -136,16 +136,16 @@ export interface AnimationChannel {
136
136
  /**
137
137
  * The index of the node and TRS property to target.
138
138
  */
139
- target: AnimationChannelTarget;
140
- extensions?: any;
139
+ target: GLTFAnimationChannelTarget;
140
+ extensions?: Record<string, any>;
141
141
  extras?: any;
142
142
  // [k: string]: any;
143
- }
143
+ };
144
144
 
145
145
  /**
146
146
  * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).
147
147
  */
148
- export interface AnimationSampler {
148
+ export type GLTFAnimationSampler = {
149
149
  /**
150
150
  * The index of an accessor containing keyframe input values, e.g., time.
151
151
  */
@@ -158,33 +158,33 @@ export interface AnimationSampler {
158
158
  * The index of an accessor, containing keyframe output values.
159
159
  */
160
160
  output: GLTFId;
161
- extensions?: any;
161
+ extensions?: Record<string, any>;
162
162
  extras?: any;
163
163
  // [k: string]: any;
164
- }
164
+ };
165
165
 
166
166
  /**
167
167
  * A keyframe animation.
168
168
  */
169
- export interface Animation {
169
+ export type GLTFAnimation = {
170
170
  /**
171
171
  * An array of channels, each of which targets an animation's sampler at a node's property. Different channels of the same animation can't have equal targets.
172
172
  */
173
- channels: AnimationChannel[];
173
+ channels: GLTFAnimationChannel[];
174
174
  /**
175
175
  * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).
176
176
  */
177
- samplers: AnimationSampler[];
177
+ samplers: GLTFAnimationSampler[];
178
178
  name?: any;
179
- extensions?: any;
179
+ extensions?: Record<string, any>;
180
180
  extras?: any;
181
181
  // [k: string]: any;
182
- }
182
+ };
183
183
 
184
184
  /**
185
185
  * Metadata about the glTF asset.
186
186
  */
187
- export interface Asset {
187
+ export type GLTFAsset = {
188
188
  /**
189
189
  * A copyright message suitable for display to credit the content creator.
190
190
  */
@@ -201,15 +201,15 @@ export interface Asset {
201
201
  * The minimum glTF version that this asset targets.
202
202
  */
203
203
  minVersion?: string;
204
- extensions?: any;
204
+ extensions?: Record<string, any>;
205
205
  extras?: any;
206
206
  // [k: string]: any;
207
- }
207
+ };
208
208
 
209
209
  /**
210
210
  * A buffer points to binary geometry, animation, or skins.
211
211
  */
212
- export interface Buffer {
212
+ export type GLTFBuffer = {
213
213
  /**
214
214
  * The uri of the buffer.
215
215
  */
@@ -219,15 +219,15 @@ export interface Buffer {
219
219
  */
220
220
  byteLength: number;
221
221
  name?: any;
222
- extensions?: any;
222
+ extensions?: Record<string, any>;
223
223
  extras?: any;
224
224
  // [k: string]: any;
225
- }
225
+ };
226
226
 
227
227
  /**
228
228
  * A view into a buffer generally representing a subset of the buffer.
229
229
  */
230
- export interface BufferView {
230
+ export type GLTFBufferView = {
231
231
  /**
232
232
  * The index of the buffer.
233
233
  */
@@ -249,15 +249,15 @@ export interface BufferView {
249
249
  */
250
250
  target?: 34962 | 34963 | number;
251
251
  name?: any;
252
- extensions?: any;
252
+ extensions?: Record<string, any>;
253
253
  extras?: any;
254
254
  // [k: string]: any;
255
- }
255
+ };
256
256
 
257
257
  /**
258
258
  * An orthographic camera containing properties to create an orthographic projection matrix.
259
259
  */
260
- export interface CameraOrthographic {
260
+ export type GLTFCameraOrthographic = {
261
261
  /**
262
262
  * The floating-point horizontal magnification of the view. Must not be zero.
263
263
  */
@@ -274,15 +274,15 @@ export interface CameraOrthographic {
274
274
  * The floating-point distance to the near clipping plane.
275
275
  */
276
276
  znear: number;
277
- extensions?: any;
277
+ extensions?: Record<string, any>;
278
278
  extras?: any;
279
279
  // [k: string]: any;
280
- }
280
+ };
281
281
 
282
282
  /**
283
283
  * A perspective camera containing properties to create a perspective projection matrix.
284
284
  */
285
- export interface CameraPerspective {
285
+ export type GLTFCameraPerspective = {
286
286
  /**
287
287
  * The floating-point aspect ratio of the field of view.
288
288
  */
@@ -299,37 +299,37 @@ export interface CameraPerspective {
299
299
  * The floating-point distance to the near clipping plane.
300
300
  */
301
301
  znear: number;
302
- extensions?: any;
302
+ extensions?: Record<string, any>;
303
303
  extras?: any;
304
304
  // [k: string]: any;
305
- }
305
+ };
306
306
 
307
307
  /**
308
308
  * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene.
309
309
  */
310
- export interface Camera {
310
+ export type GLTFCamera = {
311
311
  /**
312
312
  * An orthographic camera containing properties to create an orthographic projection matrix.
313
313
  */
314
- orthographic?: CameraOrthographic;
314
+ orthographic?: GLTFCameraOrthographic;
315
315
  /**
316
316
  * A perspective camera containing properties to create a perspective projection matrix.
317
317
  */
318
- perspective?: CameraPerspective;
318
+ perspective?: GLTFCameraPerspective;
319
319
  /**
320
320
  * Specifies if the camera uses a perspective or orthographic projection.
321
321
  */
322
322
  type: 'perspective' | 'orthographic' | string;
323
323
  name?: any;
324
- extensions?: any;
324
+ extensions?: Record<string, any>;
325
325
  extras?: any;
326
326
  // [k: string]: any;
327
- }
327
+ };
328
328
 
329
329
  /**
330
330
  * Image data used to create a texture. Image can be referenced by URI or `bufferView` index. `mimeType` is required in the latter case.
331
331
  */
332
- export interface Image {
332
+ export type GLTFImage = {
333
333
  /**
334
334
  * The uri of the image.
335
335
  */
@@ -343,15 +343,15 @@ export interface Image {
343
343
  */
344
344
  bufferView?: GLTFId;
345
345
  name?: any;
346
- extensions?: any;
346
+ extensions?: Record<string, any>;
347
347
  extras?: any;
348
348
  // [k: string]: any;
349
- }
349
+ };
350
350
 
351
351
  /**
352
352
  * Reference to a texture.
353
353
  */
354
- export interface TextureInfo {
354
+ export type GLTFTextureInfo = {
355
355
  /**
356
356
  * The index of the texture.
357
357
  */
@@ -360,15 +360,15 @@ export interface TextureInfo {
360
360
  * The set index of texture's TEXCOORD attribute used for texture coordinate mapping.
361
361
  */
362
362
  texCoord?: number;
363
- extensions?: any;
363
+ extensions?: Record<string, any>;
364
364
  extras?: any;
365
365
  // [k: string]: any;
366
- }
366
+ };
367
367
 
368
368
  /**
369
369
  * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.
370
370
  */
371
- export interface MaterialPbrMetallicRoughness {
371
+ export type GLTFMaterialPbrMetallicRoughness = {
372
372
  /**
373
373
  * The material's base color factor.
374
374
  */
@@ -376,7 +376,7 @@ export interface MaterialPbrMetallicRoughness {
376
376
  /**
377
377
  * The base color texture.
378
378
  */
379
- baseColorTexture?: TextureInfo;
379
+ baseColorTexture?: GLTFTextureInfo;
380
380
  /**
381
381
  * The metalness of the material.
382
382
  */
@@ -388,57 +388,57 @@ export interface MaterialPbrMetallicRoughness {
388
388
  /**
389
389
  * The metallic-roughness texture.
390
390
  */
391
- metallicRoughnessTexture?: TextureInfo;
392
- extensions?: any;
391
+ metallicRoughnessTexture?: GLTFTextureInfo;
392
+ extensions?: Record<string, any>;
393
393
  extras?: any;
394
394
  // [k: string]: any;
395
- }
396
- export interface MaterialNormalTextureInfo {
395
+ };
396
+ export type GLTFMaterialNormalTextureInfo = {
397
397
  index: any;
398
398
  texCoord?: any;
399
399
  /**
400
400
  * The scalar multiplier applied to each normal vector of the normal texture.
401
401
  */
402
402
  scale?: number;
403
- extensions?: any;
403
+ extensions?: Record<string, any>;
404
404
  extras?: any;
405
405
  // [k: string]: any;
406
- }
407
- export interface MaterialOcclusionTextureInfo {
406
+ };
407
+ export type GLTFMaterialOcclusionTextureInfo = {
408
408
  index: any;
409
409
  texCoord?: any;
410
410
  /**
411
411
  * A scalar multiplier controlling the amount of occlusion applied.
412
412
  */
413
413
  strength?: number;
414
- extensions?: any;
414
+ extensions?: Record<string, any>;
415
415
  extras?: any;
416
416
  // [k: string]: any;
417
- }
417
+ };
418
418
 
419
419
  /**
420
420
  * The material appearance of a primitive.
421
421
  */
422
- export interface Material {
422
+ export type GLTFMaterial = {
423
423
  name?: any;
424
- extensions?: any;
424
+ extensions?: Record<string, any>;
425
425
  extras?: any;
426
426
  /**
427
427
  * 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.
428
428
  */
429
- pbrMetallicRoughness?: MaterialPbrMetallicRoughness;
429
+ pbrMetallicRoughness?: GLTFMaterialPbrMetallicRoughness;
430
430
  /**
431
431
  * The normal map texture.
432
432
  */
433
- normalTexture?: MaterialNormalTextureInfo;
433
+ normalTexture?: GLTFMaterialNormalTextureInfo;
434
434
  /**
435
435
  * The occlusion map texture.
436
436
  */
437
- occlusionTexture?: MaterialOcclusionTextureInfo;
437
+ occlusionTexture?: GLTFMaterialOcclusionTextureInfo;
438
438
  /**
439
439
  * The emissive map texture.
440
440
  */
441
- emissiveTexture?: TextureInfo;
441
+ emissiveTexture?: GLTFTextureInfo;
442
442
  /**
443
443
  * The emissive color of the material.
444
444
  */
@@ -456,12 +456,12 @@ export interface Material {
456
456
  */
457
457
  doubleSided?: boolean;
458
458
  // [k: string]: any;
459
- }
459
+ };
460
460
 
461
461
  /**
462
462
  * Geometry to be rendered with the given material.
463
463
  */
464
- export interface MeshPrimitive {
464
+ export type GLTFMeshPrimitive = {
465
465
  /**
466
466
  * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data.
467
467
  */
@@ -486,35 +486,35 @@ export interface MeshPrimitive {
486
486
  targets?: {
487
487
  [k: string]: GLTFId;
488
488
  }[];
489
- extensions?: any;
489
+ extensions?: Record<string, any>;
490
490
  extras?: any;
491
491
  // [k: string]: any;
492
- }
492
+ };
493
493
 
494
494
  /**
495
495
  * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene.
496
496
  */
497
497
 
498
- export interface Mesh {
498
+ export type GLTFMesh = {
499
499
  id?: string;
500
500
  /**
501
501
  * An array of primitives, each defining geometry to be rendered with a material.
502
502
  */
503
- primitives: MeshPrimitive[];
503
+ primitives: GLTFMeshPrimitive[];
504
504
  /**
505
505
  * Array of weights to be applied to the Morph Targets.
506
506
  */
507
507
  weights?: number[];
508
508
  name?: any;
509
- extensions?: any;
509
+ extensions?: Record<string, any>;
510
510
  extras?: any;
511
511
  // [k: string]: any;
512
- }
512
+ };
513
513
 
514
514
  /**
515
515
  * A node in the node hierarchy. When the node contains `skin`, all `mesh.primitives` must contain `JOINTS_0` and `WEIGHTS_0` attributes. A node can have either a `matrix` or any combination of `translation`/`rotation`/`scale` (TRS) properties. TRS properties are converted to matrices and postmultiplied in the `T * R * S` order to compose the transformation matrix; first the scale is applied to the vertices, then the rotation, and then the translation. If none are provided, the transform is the identity. When a node is targeted for animation (referenced by an animation.channel.target), only TRS properties may be present; `matrix` will not be present.
516
516
  */
517
- export interface Node {
517
+ export type GLTFNode = {
518
518
  /**
519
519
  * The index of the camera referenced by this node.
520
520
  */
@@ -552,15 +552,15 @@ export interface Node {
552
552
  */
553
553
  weights?: number[];
554
554
  name?: any;
555
- extensions?: any;
555
+ extensions?: Record<string, any>;
556
556
  extras?: any;
557
557
  // [k: string]: any;
558
- }
558
+ };
559
559
 
560
560
  /**
561
561
  * Texture sampler properties for filtering and wrapping modes.
562
562
  */
563
- export interface Sampler {
563
+ export type GLTFSampler = {
564
564
  /**
565
565
  * Magnification filter.
566
566
  */
@@ -578,29 +578,30 @@ export interface Sampler {
578
578
  */
579
579
  wrapT?: 33071 | 33648 | 10497 | number;
580
580
  name?: any;
581
- extensions?: any;
581
+ extensions?: Record<string, any>;
582
582
  extras?: any;
583
583
  // [k: string]: any;
584
- }
584
+ };
585
585
 
586
586
  /**
587
587
  * The root nodes of a scene.
588
588
  */
589
- export interface Scene {
589
+ export type GLTFScene = {
590
590
  /**
591
591
  * The indices of each root node.
592
592
  */
593
593
  nodes?: GLTFId[];
594
594
  name?: any;
595
- extensions?: any;
595
+ extensions?: Record<string, any>;
596
596
  extras?: any;
597
597
  // [k: string]: any;
598
- }
598
+ };
599
599
 
600
600
  /**
601
601
  * Joints and matrices defining a skin.
602
602
  */
603
- export interface Skin {
603
+ export type GLTFSkin = {
604
+ id?: string;
604
605
  /**
605
606
  * 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.
606
607
  */
@@ -609,38 +610,32 @@ export interface Skin {
609
610
  * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root.
610
611
  */
611
612
  skeleton?: GLTFId;
612
- /**
613
- * Indices of skeleton nodes, used as joints in this skin.
614
- */
613
+ /** Indices of skeleton nodes, used as joints in this skin. */
615
614
  joints: GLTFId[];
616
615
  name?: any;
617
- extensions?: any;
616
+ extensions?: Record<string, any>;
618
617
  extras?: any;
619
618
  // [k: string]: any;
620
- }
619
+ };
621
620
 
622
621
  /**
623
622
  * A texture and its sampler.
624
623
  */
625
- export interface Texture {
626
- /**
627
- * The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used.
628
- */
624
+ export type GLTFTexture = {
625
+ /** The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used. */
629
626
  sampler?: GLTFId;
630
- /**
631
- * The index of the image used by this texture.
632
- */
627
+ /** The index of the image used by this texture. */
633
628
  source?: GLTFId;
634
629
  name?: any;
635
- extensions?: any;
630
+ extensions?: Record<string, any>;
636
631
  extras?: any;
637
632
  // [k: string]: any;
638
- }
633
+ };
639
634
 
640
635
  /**
641
636
  * The root object for a glTF asset.
642
637
  */
643
- export interface GLTF {
638
+ export type GLTF = {
644
639
  /**
645
640
  * Names of glTF extensions used somewhere in this asset.
646
641
  */
@@ -652,47 +647,47 @@ export interface GLTF {
652
647
  /**
653
648
  * An array of accessors.
654
649
  */
655
- accessors?: Accessor[];
650
+ accessors?: GLTFAccessor[];
656
651
  /**
657
652
  * An array of keyframe animations.
658
653
  */
659
- animations?: Animation[];
654
+ animations?: GLTFAnimation[];
660
655
  /**
661
656
  * Metadata about the glTF asset.
662
657
  */
663
- asset: Asset;
658
+ asset: GLTFAsset;
664
659
  /**
665
660
  * An array of buffers.
666
661
  */
667
- buffers?: Buffer[];
662
+ buffers?: GLTFBuffer[];
668
663
  /**
669
664
  * An array of bufferViews.
670
665
  */
671
- bufferViews?: BufferView[];
666
+ bufferViews?: GLTFBufferView[];
672
667
  /**
673
668
  * An array of cameras.
674
669
  */
675
- cameras?: Camera[];
670
+ cameras?: GLTFCamera[];
676
671
  /**
677
672
  * An array of images.
678
673
  */
679
- images?: Image[];
674
+ images?: GLTFImage[];
680
675
  /**
681
676
  * An array of materials.
682
677
  */
683
- materials?: Material[];
678
+ materials?: GLTFMaterial[];
684
679
  /**
685
680
  * An array of meshes.
686
681
  */
687
- meshes?: Mesh[];
682
+ meshes?: GLTFMesh[];
688
683
  /**
689
684
  * An array of nodes.
690
685
  */
691
- nodes?: Node[];
686
+ nodes?: GLTFNode[];
692
687
  /**
693
688
  * An array of samplers.
694
689
  */
695
- samplers?: Sampler[];
690
+ samplers?: GLTFSampler[];
696
691
  /**
697
692
  * The index of the default scene.
698
693
  */
@@ -700,19 +695,19 @@ export interface GLTF {
700
695
  /**
701
696
  * An array of scenes.
702
697
  */
703
- scenes?: Scene[];
698
+ scenes?: GLTFScene[];
704
699
  /**
705
700
  * An array of skins.
706
701
  */
707
- skins?: Skin[];
702
+ skins?: GLTFSkin[];
708
703
  /**
709
704
  * An array of textures.
710
705
  */
711
- textures?: Texture[];
712
- extensions?: unknown;
706
+ textures?: GLTFTexture[];
707
+ extensions?: Record<string, unknown>;
713
708
  extras?: unknown;
714
709
  [k: string]: unknown;
715
- }
710
+ };
716
711
 
717
712
  // GLTF Extensions
718
713
  /* eslint-disable camelcase */
@@ -784,6 +779,24 @@ export type GLTF_MSFT_texture_dds = {
784
779
  extras?: any;
785
780
  };
786
781
 
782
+ /**
783
+ * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#gltf-extension-1
784
+ * @todo belom88 complete typings
785
+ */
786
+ export type GLTF_EXT_mesh_features = {
787
+ featureIds: {
788
+ featureCount: number;
789
+ nullFeatureId: number;
790
+ label: string;
791
+ attribute: any;
792
+ texture: any;
793
+ propertyTable: number;
794
+ }[];
795
+ extensions?: any;
796
+ extras?: any;
797
+ [key: string]: any;
798
+ };
799
+
787
800
  /**
788
801
  * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#gltf-extension-1
789
802
  */
@@ -802,7 +815,7 @@ export type GLTF_EXT_feature_metadata = {
802
815
  featureTextures?: {
803
816
  [key: string]: FeatureTexture;
804
817
  };
805
- extensions?: any;
818
+ extensions?: Record<string, any>;
806
819
  extras?: any;
807
820
  [key: string]: any;
808
821
  };
@@ -825,7 +838,7 @@ type ExtFeatureMetadataSchema = {
825
838
  enums?: {
826
839
  [key: string]: ExtFeatureMetadataEnum;
827
840
  };
828
- extensions?: any;
841
+ extensions?: Record<string, any>;
829
842
  extras?: any;
830
843
  [key: string]: any;
831
844
  };
@@ -842,7 +855,7 @@ export type EXT_feature_metadata_class_object = {
842
855
  properties: {
843
856
  [key: string]: ClassProperty;
844
857
  };
845
- extensions?: any;
858
+ extensions?: Record<string, any>;
846
859
  extras?: any;
847
860
  [key: string]: any;
848
861
  };
@@ -927,7 +940,7 @@ export type ClassProperty = {
927
940
  * The semantic cannot be used by other properties in the class.
928
941
  */
929
942
  semantic?: string;
930
- extensions?: any;
943
+ extensions?: Record<string, any>;
931
944
  extras?: any;
932
945
  [key: string]: any;
933
946
  };
@@ -963,7 +976,7 @@ type ExtFeatureMetadataEnum = {
963
976
  valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64'; // default: "UINT16"
964
977
  /** An array of enum values. Duplicate names or duplicate integer values are not allowed. */
965
978
  values: EnumValue[];
966
- extensions?: any;
979
+ extensions?: Record<string, any>;
967
980
  extras?: any;
968
981
  [key: string]: any;
969
982
  };
@@ -978,7 +991,7 @@ type EnumValue = {
978
991
  description?: string;
979
992
  /** The integer enum value. */
980
993
  value: number; // default: "UINT16"
981
- extensions?: any;
994
+ extensions?: Record<string, any>;
982
995
  extras?: any;
983
996
  [key: string]: any;
984
997
  };
@@ -1000,7 +1013,7 @@ export type EXT_feature_metadata_feature_table = {
1000
1013
  properties?: {
1001
1014
  [key: string]: FeatureTableProperty;
1002
1015
  };
1003
- extensions?: any;
1016
+ extensions?: Record<string, any>;
1004
1017
  extras?: any;
1005
1018
  [key: string]: any;
1006
1019
  };
@@ -1048,7 +1061,7 @@ export type FeatureTableProperty = {
1048
1061
  * The buffer view byteOffset must be aligned to a multiple of 8 bytes in the same manner as the main bufferView.
1049
1062
  */
1050
1063
  stringOffsetBufferView?: number;
1051
- extensions?: any;
1064
+ extensions?: Record<string, any>;
1052
1065
  extras?: any;
1053
1066
  [key: string]: any;
1054
1067
  };
@@ -1066,7 +1079,7 @@ type FeatureTexture = {
1066
1079
  properties: {
1067
1080
  [key: string]: TextureAccessor;
1068
1081
  };
1069
- extensions?: any;
1082
+ extensions?: Record<string, any>;
1070
1083
  extras?: any;
1071
1084
  [key: string]: any;
1072
1085
  };
@@ -1078,8 +1091,8 @@ type TextureAccessor = {
1078
1091
  /** Texture channels containing property values. Channels are labeled by rgba and are swizzled with a string of 1-4 characters. */
1079
1092
  channels: string;
1080
1093
  /** The glTF texture and texture coordinates to use. */
1081
- texture: TextureInfo;
1082
- extensions?: any;
1094
+ texture: GLTFTextureInfo;
1095
+ extensions?: Record<string, any>;
1083
1096
  extras?: any;
1084
1097
  [key: string]: any;
1085
1098
  };
@@ -1095,7 +1108,7 @@ type Statistics = {
1095
1108
  classes?: {
1096
1109
  [key: string]: ClassStatistics;
1097
1110
  };
1098
- extensions?: any;
1111
+ extensions?: Record<string, any>;
1099
1112
  extras?: any;
1100
1113
  [key: string]: any;
1101
1114
  };
@@ -1113,7 +1126,7 @@ type ClassStatistics = {
1113
1126
  properties?: {
1114
1127
  [key: string]: StatisticsClassProperty;
1115
1128
  };
1116
- extensions?: any;
1129
+ extensions?: Record<string, any>;
1117
1130
  extras?: any;
1118
1131
  [key: string]: any;
1119
1132
  };
@@ -1149,7 +1162,7 @@ type StatisticsClassProperty = {
1149
1162
  occurrences: {
1150
1163
  [key: string]: number | number[];
1151
1164
  };
1152
- extensions?: any;
1165
+ extensions?: Record<string, any>;
1153
1166
  extras?: any;
1154
1167
  [key: string]: any;
1155
1168
  };
@@ -1165,7 +1178,7 @@ export type GLTF_EXT_feature_metadata_primitive = {
1165
1178
  featureIdTextures?: GLTF_EXT_feature_metadata_attribute[];
1166
1179
  /** An array of IDs of feature textures from the root EXT_feature_metadata object. */
1167
1180
  featureTextures?: string[];
1168
- extensions?: any;
1181
+ extensions?: Record<string, any>;
1169
1182
  extras?: any;
1170
1183
  [key: string]: any;
1171
1184
  };
@@ -1178,7 +1191,7 @@ export type GLTF_EXT_feature_metadata_attribute = {
1178
1191
  featureTable: string;
1179
1192
  /** Described how feature ids are defined */
1180
1193
  featureIds: ExtFeatureMetadataFeatureIds;
1181
- extensions?: any;
1194
+ extensions?: Record<string, any>;
1182
1195
  extras?: any;
1183
1196
  [key: string]: any;
1184
1197
  };
@@ -1212,3 +1225,17 @@ type ExtFeatureMetadataTexture = {
1212
1225
  /** The index of the texture. */
1213
1226
  index: number;
1214
1227
  };
1228
+
1229
+ export type GLTFObject =
1230
+ | GLTFAccessor
1231
+ | GLTFBuffer
1232
+ | GLTFBufferView
1233
+ | GLTFMeshPrimitive
1234
+ | GLTFMesh
1235
+ | GLTFNode
1236
+ | GLTFMaterial
1237
+ | GLTFSampler
1238
+ | GLTFScene
1239
+ | GLTFSkin
1240
+ | GLTFTexture
1241
+ | GLTFImage;