@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
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // loaders.gl, MIT license
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.postProcessGLTF = void 0;
4
5
  const assert_1 = require("../utils/assert");
@@ -47,12 +48,18 @@ const SAMPLER_PARAMETER_GLTF_TO_GL = {
47
48
  };
48
49
  // When undefined, a sampler with repeat wrapping and auto filtering should be used.
49
50
  // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture
50
- const DEFAULT_SAMPLER = {
51
+ const DEFAULT_SAMPLER_PARAMETERS = {
51
52
  [GL_SAMPLER.TEXTURE_MAG_FILTER]: GL_SAMPLER.LINEAR,
52
53
  [GL_SAMPLER.TEXTURE_MIN_FILTER]: GL_SAMPLER.NEAREST_MIPMAP_LINEAR,
53
54
  [GL_SAMPLER.TEXTURE_WRAP_S]: GL_SAMPLER.REPEAT,
54
55
  [GL_SAMPLER.TEXTURE_WRAP_T]: GL_SAMPLER.REPEAT
55
56
  };
57
+ function makeDefaultSampler() {
58
+ return {
59
+ id: 'default-sampler',
60
+ parameters: DEFAULT_SAMPLER_PARAMETERS
61
+ };
62
+ }
56
63
  function getBytesFromComponentType(componentType) {
57
64
  return BYTES[componentType];
58
65
  }
@@ -62,100 +69,106 @@ function getSizeFromAccessorType(type) {
62
69
  class GLTFPostProcessor {
63
70
  constructor() {
64
71
  this.baseUri = '';
65
- this.json = {};
66
72
  this.buffers = [];
67
73
  this.images = [];
68
74
  }
69
75
  postProcess(gltf, options = {}) {
70
- const { json, buffers = [], images = [], baseUri = '' } = gltf;
76
+ const { json, buffers = [], images = [] } = gltf;
77
+ // @ts-expect-error
78
+ const { baseUri = '' } = gltf;
71
79
  (0, assert_1.assert)(json);
72
80
  this.baseUri = baseUri;
73
- this.json = json;
74
81
  this.buffers = buffers;
75
82
  this.images = images;
76
- this._resolveTree(this.json, options);
83
+ this.jsonUnprocessed = json;
84
+ this.json = this._resolveTree(gltf.json, options);
77
85
  return this.json;
78
86
  }
79
87
  // Convert indexed glTF structure into tree structure
80
88
  // cross-link index resolution, enum lookup, convenience calculations
81
- // eslint-disable-next-line complexity
82
- _resolveTree(json, options = {}) {
83
- if (json.bufferViews) {
84
- json.bufferViews = json.bufferViews.map((bufView, i) => this._resolveBufferView(bufView, i));
89
+ // eslint-disable-next-line complexity, max-statements
90
+ _resolveTree(gltf, options = {}) {
91
+ // @ts-expect-error
92
+ const json = { ...gltf };
93
+ this.json = json;
94
+ if (gltf.bufferViews) {
95
+ json.bufferViews = gltf.bufferViews.map((bufView, i) => this._resolveBufferView(bufView, i));
85
96
  }
86
- if (json.images) {
87
- json.images = json.images.map((image, i) => this._resolveImage(image, i));
97
+ if (gltf.images) {
98
+ json.images = gltf.images.map((image, i) => this._resolveImage(image, i));
88
99
  }
89
- if (json.samplers) {
90
- json.samplers = json.samplers.map((sampler, i) => this._resolveSampler(sampler, i));
100
+ if (gltf.samplers) {
101
+ json.samplers = gltf.samplers.map((sampler, i) => this._resolveSampler(sampler, i));
91
102
  }
92
- if (json.textures) {
93
- json.textures = json.textures.map((texture, i) => this._resolveTexture(texture, i));
103
+ if (gltf.textures) {
104
+ json.textures = gltf.textures.map((texture, i) => this._resolveTexture(texture, i));
94
105
  }
95
- if (json.accessors) {
96
- json.accessors = json.accessors.map((accessor, i) => this._resolveAccessor(accessor, i));
106
+ if (gltf.accessors) {
107
+ json.accessors = gltf.accessors.map((accessor, i) => this._resolveAccessor(accessor, i));
97
108
  }
98
- if (json.materials) {
99
- json.materials = json.materials.map((material, i) => this._resolveMaterial(material, i));
109
+ if (gltf.materials) {
110
+ json.materials = gltf.materials.map((material, i) => this._resolveMaterial(material, i));
100
111
  }
101
- if (json.meshes) {
102
- json.meshes = json.meshes.map((mesh, i) => this._resolveMesh(mesh, i));
112
+ if (gltf.meshes) {
113
+ json.meshes = gltf.meshes.map((mesh, i) => this._resolveMesh(mesh, i));
103
114
  }
104
- if (json.nodes) {
105
- json.nodes = json.nodes.map((node, i) => this._resolveNode(node, i));
115
+ if (gltf.nodes) {
116
+ json.nodes = gltf.nodes.map((node, i) => this._resolveNode(node, i));
117
+ json.nodes = json.nodes.map((node, i) => this._resolveNodeChildren(node));
106
118
  }
107
- if (json.skins) {
108
- json.skins = json.skins.map((skin, i) => this._resolveSkin(skin, i));
119
+ if (gltf.skins) {
120
+ json.skins = gltf.skins.map((skin, i) => this._resolveSkin(skin, i));
109
121
  }
110
- if (json.scenes) {
111
- json.scenes = json.scenes.map((scene, i) => this._resolveScene(scene, i));
122
+ if (gltf.scenes) {
123
+ json.scenes = gltf.scenes.map((scene, i) => this._resolveScene(scene, i));
112
124
  }
113
- if (json.scene !== undefined) {
125
+ if (typeof this.json.scene === 'number' && json.scenes) {
114
126
  json.scene = json.scenes[this.json.scene];
115
127
  }
128
+ return json;
116
129
  }
117
130
  getScene(index) {
118
- return this._get('scenes', index);
131
+ return this._get(this.json.scenes, index);
119
132
  }
120
133
  getNode(index) {
121
- return this._get('nodes', index);
134
+ return this._get(this.json.nodes, index);
122
135
  }
123
136
  getSkin(index) {
124
- return this._get('skins', index);
137
+ return this._get(this.json.skins, index);
125
138
  }
126
139
  getMesh(index) {
127
- return this._get('meshes', index);
140
+ return this._get(this.json.meshes, index);
128
141
  }
129
142
  getMaterial(index) {
130
- return this._get('materials', index);
143
+ return this._get(this.json.materials, index);
131
144
  }
132
145
  getAccessor(index) {
133
- return this._get('accessors', index);
146
+ return this._get(this.json.accessors, index);
134
147
  }
135
148
  getCamera(index) {
136
- return null; // TODO: fix this
149
+ return this._get(this.json.cameras, index);
137
150
  }
138
151
  getTexture(index) {
139
- return this._get('textures', index);
152
+ return this._get(this.json.textures, index);
140
153
  }
141
154
  getSampler(index) {
142
- return this._get('samplers', index);
155
+ return this._get(this.json.samplers, index);
143
156
  }
144
157
  getImage(index) {
145
- return this._get('images', index);
158
+ return this._get(this.json.images, index);
146
159
  }
147
160
  getBufferView(index) {
148
- return this._get('bufferViews', index);
161
+ return this._get(this.json.bufferViews, index);
149
162
  }
150
163
  getBuffer(index) {
151
- return this._get('buffers', index);
164
+ return this._get(this.json.buffers, index);
152
165
  }
153
166
  _get(array, index) {
154
167
  // check if already resolved
155
168
  if (typeof index === 'object') {
156
169
  return index;
157
170
  }
158
- const object = this.json[array] && this.json[array][index];
171
+ const object = array && array[index];
159
172
  if (!object) {
160
173
  console.warn(`glTF file error: Could not find ${array}[${index}]`); // eslint-disable-line
161
174
  }
@@ -163,81 +176,109 @@ class GLTFPostProcessor {
163
176
  }
164
177
  // PARSING HELPERS
165
178
  _resolveScene(scene, index) {
166
- // scene = {...scene};
167
- scene.id = scene.id || `scene-${index}`;
168
- scene.nodes = (scene.nodes || []).map((node) => this.getNode(node));
169
- return scene;
179
+ return {
180
+ ...scene,
181
+ // @ts-ignore
182
+ id: scene.id || `scene-${index}`,
183
+ nodes: (scene.nodes || []).map((node) => this.getNode(node))
184
+ };
170
185
  }
171
- _resolveNode(node, index) {
172
- // node = {...node};
173
- node.id = node.id || `node-${index}`;
174
- if (node.children) {
175
- node.children = node.children.map((child) => this.getNode(child));
186
+ _resolveNode(gltfNode, index) {
187
+ // @ts-expect-error
188
+ const node = {
189
+ ...gltfNode,
190
+ // @ts-expect-error id could already be present, glTF standard does not prevent it
191
+ id: gltfNode?.id || `node-${index}`
192
+ };
193
+ if (gltfNode.mesh !== undefined) {
194
+ node.mesh = this.getMesh(gltfNode.mesh);
195
+ }
196
+ if (gltfNode.camera !== undefined) {
197
+ node.camera = this.getCamera(gltfNode.camera);
176
198
  }
177
- if (node.mesh !== undefined) {
178
- node.mesh = this.getMesh(node.mesh);
199
+ if (gltfNode.skin !== undefined) {
200
+ node.skin = this.getSkin(gltfNode.skin);
179
201
  }
180
- else if (node.meshes !== undefined && node.meshes.length) {
181
- node.mesh = node.meshes.reduce((accum, meshIndex) => {
202
+ // TODO deprecated - Delete in v4.0?
203
+ // @ts-expect-error node.meshes does not seem to be part of the GLTF standard
204
+ if (gltfNode.meshes !== undefined && gltfNode.meshes.length) {
205
+ // @ts-expect-error
206
+ node.mesh = gltfNode.meshes.reduce((accum, meshIndex) => {
182
207
  const mesh = this.getMesh(meshIndex);
183
208
  accum.id = mesh.id;
184
209
  accum.primitives = accum.primitives.concat(mesh.primitives);
185
210
  return accum;
186
211
  }, { primitives: [] });
187
212
  }
188
- if (node.camera !== undefined) {
189
- node.camera = this.getCamera(node.camera);
190
- }
191
- if (node.skin !== undefined) {
192
- node.skin = this.getSkin(node.skin);
213
+ return node;
214
+ }
215
+ _resolveNodeChildren(node) {
216
+ if (node.children) {
217
+ // @ts-expect-error node.children are numbers at this stage
218
+ node.children = node.children.map((child) => this.getNode(child));
193
219
  }
194
220
  return node;
195
221
  }
196
- _resolveSkin(skin, index) {
197
- // skin = {...skin};
198
- skin.id = skin.id || `skin-${index}`;
199
- skin.inverseBindMatrices = this.getAccessor(skin.inverseBindMatrices);
200
- return skin;
222
+ _resolveSkin(gltfSkin, index) {
223
+ const inverseBindMatrices = typeof gltfSkin.inverseBindMatrices === 'number'
224
+ ? this.getAccessor(gltfSkin.inverseBindMatrices)
225
+ : undefined;
226
+ return {
227
+ ...gltfSkin,
228
+ id: gltfSkin.id || `skin-${index}`,
229
+ inverseBindMatrices
230
+ };
201
231
  }
202
- _resolveMesh(mesh, index) {
203
- // mesh = {...mesh};
204
- mesh.id = mesh.id || `mesh-${index}`;
205
- if (mesh.primitives) {
206
- mesh.primitives = mesh.primitives.map((primitive) => {
207
- primitive = { ...primitive };
208
- const attributes = primitive.attributes;
209
- primitive.attributes = {};
232
+ _resolveMesh(gltfMesh, index) {
233
+ const mesh = {
234
+ ...gltfMesh,
235
+ id: gltfMesh.id || `mesh-${index}`,
236
+ primitives: []
237
+ };
238
+ if (gltfMesh.primitives) {
239
+ mesh.primitives = gltfMesh.primitives.map((gltfPrimitive) => {
240
+ const primitive = {
241
+ ...gltfPrimitive,
242
+ attributes: {},
243
+ indices: undefined,
244
+ material: undefined
245
+ };
246
+ const attributes = gltfPrimitive.attributes;
210
247
  for (const attribute in attributes) {
211
248
  primitive.attributes[attribute] = this.getAccessor(attributes[attribute]);
212
249
  }
213
- if (primitive.indices !== undefined) {
214
- primitive.indices = this.getAccessor(primitive.indices);
250
+ if (gltfPrimitive.indices !== undefined) {
251
+ primitive.indices = this.getAccessor(gltfPrimitive.indices);
215
252
  }
216
- if (primitive.material !== undefined) {
217
- primitive.material = this.getMaterial(primitive.material);
253
+ if (gltfPrimitive.material !== undefined) {
254
+ primitive.material = this.getMaterial(gltfPrimitive.material);
218
255
  }
219
256
  return primitive;
220
257
  });
221
258
  }
222
259
  return mesh;
223
260
  }
224
- _resolveMaterial(material, index) {
225
- // material = {...material};
226
- material.id = material.id || `material-${index}`;
261
+ _resolveMaterial(gltfMaterial, index) {
262
+ // @ts-expect-error
263
+ const material = {
264
+ ...gltfMaterial,
265
+ // @ts-expect-error
266
+ id: gltfMaterial.id || `material-${index}`
267
+ };
227
268
  if (material.normalTexture) {
228
269
  material.normalTexture = { ...material.normalTexture };
229
270
  material.normalTexture.texture = this.getTexture(material.normalTexture.index);
230
271
  }
231
272
  if (material.occlusionTexture) {
232
- material.occlustionTexture = { ...material.occlustionTexture };
273
+ material.occlusionTexture = { ...material.occlusionTexture };
233
274
  material.occlusionTexture.texture = this.getTexture(material.occlusionTexture.index);
234
275
  }
235
276
  if (material.emissiveTexture) {
236
- material.emmisiveTexture = { ...material.emmisiveTexture };
277
+ material.emissiveTexture = { ...material.emissiveTexture };
237
278
  material.emissiveTexture.texture = this.getTexture(material.emissiveTexture.index);
238
279
  }
239
280
  if (!material.emissiveFactor) {
240
- material.emissiveFactor = material.emmisiveTexture ? [1, 1, 1] : [0, 0, 0];
281
+ material.emissiveFactor = material.emissiveTexture ? [1, 1, 1] : [0, 0, 0];
241
282
  }
242
283
  if (material.pbrMetallicRoughness) {
243
284
  material.pbrMetallicRoughness = { ...material.pbrMetallicRoughness };
@@ -253,17 +294,26 @@ class GLTFPostProcessor {
253
294
  }
254
295
  return material;
255
296
  }
256
- _resolveAccessor(accessor, index) {
257
- // accessor = {...accessor};
258
- accessor.id = accessor.id || `accessor-${index}`;
259
- if (accessor.bufferView !== undefined) {
297
+ _resolveAccessor(gltfAccessor, index) {
298
+ // Look up enums
299
+ const bytesPerComponent = getBytesFromComponentType(gltfAccessor.componentType);
300
+ const components = getSizeFromAccessorType(gltfAccessor.type);
301
+ const bytesPerElement = bytesPerComponent * components;
302
+ const accessor = {
303
+ ...gltfAccessor,
304
+ // @ts-expect-error
305
+ id: gltfAccessor.id || `accessor-${index}`,
306
+ bytesPerComponent,
307
+ components,
308
+ bytesPerElement,
309
+ value: undefined,
310
+ bufferView: undefined,
311
+ sparse: undefined
312
+ };
313
+ if (gltfAccessor.bufferView !== undefined) {
260
314
  // Draco encoded meshes don't have bufferView
261
- accessor.bufferView = this.getBufferView(accessor.bufferView);
315
+ accessor.bufferView = this.getBufferView(gltfAccessor.bufferView);
262
316
  }
263
- // Look up enums
264
- accessor.bytesPerComponent = getBytesFromComponentType(accessor.componentType);
265
- accessor.components = getSizeFromAccessorType(accessor.type);
266
- accessor.bytesPerElement = accessor.bytesPerComponent * accessor.components;
267
317
  // Create TypedArray for the accessor
268
318
  // Note: The canonical way to instantiate is to ignore this array and create
269
319
  // WebGLBuffer's using the bufferViews.
@@ -297,18 +347,25 @@ class GLTFPostProcessor {
297
347
  }
298
348
  return result.buffer;
299
349
  }
300
- _resolveTexture(texture, index) {
301
- // texture = {...texture};
302
- texture.id = texture.id || `texture-${index}`;
303
- texture.sampler = 'sampler' in texture ? this.getSampler(texture.sampler) : DEFAULT_SAMPLER;
304
- texture.source = this.getImage(texture.source);
305
- return texture;
350
+ _resolveTexture(gltfTexture, index) {
351
+ return {
352
+ ...gltfTexture,
353
+ // @ts-expect-error id could already be present, glTF standard does not prevent it
354
+ id: gltfTexture.id || `texture-${index}`,
355
+ sampler: typeof gltfTexture.sampler === 'number'
356
+ ? this.getSampler(gltfTexture.sampler)
357
+ : makeDefaultSampler(),
358
+ source: typeof gltfTexture.source === 'number' ? this.getImage(gltfTexture.source) : undefined
359
+ };
306
360
  }
307
- _resolveSampler(sampler, index) {
308
- // sampler = {...sampler};
309
- sampler.id = sampler.id || `sampler-${index}`;
361
+ _resolveSampler(gltfSampler, index) {
362
+ const sampler = {
363
+ // @ts-expect-error id could already be present, glTF standard does not prevent it
364
+ id: gltfSampler.id || `sampler-${index}`,
365
+ ...gltfSampler,
366
+ parameters: {}
367
+ };
310
368
  // Map textual parameters to GL parameter values
311
- sampler.parameters = {};
312
369
  for (const key in sampler) {
313
370
  const glEnum = this._enumSamplerParameter(key);
314
371
  if (glEnum !== undefined) {
@@ -320,12 +377,14 @@ class GLTFPostProcessor {
320
377
  _enumSamplerParameter(key) {
321
378
  return SAMPLER_PARAMETER_GLTF_TO_GL[key];
322
379
  }
323
- _resolveImage(image, index) {
324
- // image = {...image};
325
- image.id = image.id || `image-${index}`;
326
- if (image.bufferView !== undefined) {
327
- image.bufferView = this.getBufferView(image.bufferView);
328
- }
380
+ _resolveImage(gltfImage, index) {
381
+ const image = {
382
+ ...gltfImage,
383
+ // @ts-expect-error id could already be present, glTF standard does not prevent it
384
+ id: gltfImage.id || `image-${index}`,
385
+ image: null,
386
+ bufferView: gltfImage.bufferView !== undefined ? this.getBufferView(gltfImage.bufferView) : undefined
387
+ };
329
388
  // Check if image has been preloaded by the GLTFLoader
330
389
  // If so, link it into the JSON and drop the URI
331
390
  const preloadedImage = this.images[index];
@@ -334,26 +393,30 @@ class GLTFPostProcessor {
334
393
  }
335
394
  return image;
336
395
  }
337
- _resolveBufferView(bufferView, index) {
338
- // bufferView = {...bufferView};
339
- const bufferIndex = bufferView.buffer;
340
- const result = {
341
- id: `bufferView-${index}`,
342
- ...bufferView,
343
- buffer: this.buffers[bufferIndex]
344
- };
345
- // @ts-expect-error
396
+ _resolveBufferView(gltfBufferView, index) {
397
+ const bufferIndex = gltfBufferView.buffer;
346
398
  const arrayBuffer = this.buffers[bufferIndex].arrayBuffer;
347
- // @ts-expect-error
399
+ // Add offset of buffer, then offset of buffer view
348
400
  let byteOffset = this.buffers[bufferIndex].byteOffset || 0;
349
- if ('byteOffset' in bufferView) {
350
- byteOffset += bufferView.byteOffset;
401
+ if (gltfBufferView.byteOffset) {
402
+ byteOffset += gltfBufferView.byteOffset;
351
403
  }
352
- result.data = new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);
353
- return result;
404
+ const bufferView = {
405
+ // // @ts-expect-error id could already be present, glTF standard does not prevent it
406
+ id: `bufferView-${index}`,
407
+ ...gltfBufferView,
408
+ // ...this.buffers[bufferIndex],
409
+ buffer: this.buffers[bufferIndex],
410
+ data: new Uint8Array(arrayBuffer, byteOffset, gltfBufferView.byteLength)
411
+ };
412
+ return bufferView;
354
413
  }
355
- _resolveCamera(camera, index) {
356
- camera.id = camera.id || `camera-${index}`;
414
+ _resolveCamera(gltfCamera, index) {
415
+ const camera = {
416
+ ...gltfCamera,
417
+ // @ts-expect-error id could already be present, glTF standard does not prevent it
418
+ id: gltfCamera.id || `camera-${index}`
419
+ };
357
420
  // TODO - create 4x4 matrices
358
421
  if (camera.perspective) {
359
422
  // camera.matrix = createPerspectiveMatrix(camera.perspective);
@@ -1,3 +1,15 @@
1
1
  export type GLBEncodeOptions = {};
2
- export default function encodeGLBSync(glb: any, dataView: any, byteOffset?: number, options?: GLBEncodeOptions): number;
2
+ /**
3
+ * Encode the full GLB buffer with header etc
4
+ *
5
+ * @param glb
6
+ * @param dataView - if `null`, does not encode but just calculates length
7
+ * @param byteOffset
8
+ * @param options
9
+ * @returns
10
+ *
11
+ * @see https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#glb-file-format-specification
12
+ * @todo type GLB argument
13
+ */
14
+ export declare function encodeGLBSync(glb: any, dataView: DataView | null, byteOffset?: number, options?: GLBEncodeOptions): number;
3
15
  //# sourceMappingURL=encode-glb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encode-glb.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/encode-glb.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAKlC,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,GAAG,KAAA,EACH,QAAQ,KAAA,EACR,UAAU,SAAI,EACd,OAAO,GAAE,gBAAqB,UA4D/B"}
1
+ {"version":3,"file":"encode-glb.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/encode-glb.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,GAAG,KAAA,EACH,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,UAAU,SAAI,EACd,OAAO,GAAE,gBAAqB,UA4D/B"}
@@ -1,14 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encodeGLBSync = void 0;
3
4
  /* eslint-disable camelcase, max-statements */
4
5
  const loader_utils_1 = require("@loaders.gl/loader-utils");
6
+ // import type {GLB} from '../types/glb-types.js';
5
7
  const MAGIC_glTF = 0x46546c67; // glTF in ASCII
6
8
  const MAGIC_JSON = 0x4e4f534a; // JSON in ASCII
7
9
  const MAGIC_BIN = 0x004e4942; // BIN\0 in ASCII
8
10
  const LE = true; // Binary GLTF is little endian.
9
- // Encode the full GLB buffer with header etc
10
- // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#
11
- // glb-file-format-specification
11
+ /**
12
+ * Encode the full GLB buffer with header etc
13
+ *
14
+ * @param glb
15
+ * @param dataView - if `null`, does not encode but just calculates length
16
+ * @param byteOffset
17
+ * @param options
18
+ * @returns
19
+ *
20
+ * @see https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#glb-file-format-specification
21
+ * @todo type GLB argument
22
+ */
12
23
  function encodeGLBSync(glb, dataView, byteOffset = 0, options = {}) {
13
24
  const { magic = MAGIC_glTF, version = 2, json = {}, binary } = glb;
14
25
  const byteOffsetStart = byteOffset;
@@ -58,4 +69,4 @@ function encodeGLBSync(glb, dataView, byteOffset = 0, options = {}) {
58
69
  }
59
70
  return byteOffset;
60
71
  }
61
- exports.default = encodeGLBSync;
72
+ exports.encodeGLBSync = encodeGLBSync;
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.encodeGLTFSync = void 0;
7
- const encode_glb_1 = __importDefault(require("./encode-glb"));
4
+ const encode_glb_1 = require("./encode-glb");
8
5
  /**
9
6
  * Encode the full glTF file as a binary GLB file
10
7
  * Returns an ArrayBuffer that represents the complete GLB image that can be saved to file
@@ -25,7 +22,7 @@ const encode_glb_1 = __importDefault(require("./encode-glb"));
25
22
  function encodeGLTFSync(gltf, arrayBuffer, byteOffset, options) {
26
23
  convertBuffersToBase64(gltf);
27
24
  // TODO: Copy buffers to binary
28
- return (0, encode_glb_1.default)(gltf, arrayBuffer, byteOffset, options);
25
+ return (0, encode_glb_1.encodeGLBSync)(gltf, arrayBuffer, byteOffset, options);
29
26
  }
30
27
  exports.encodeGLTFSync = encodeGLTFSync;
31
28
  function convertBuffersToBase64(gltf, { firstBuffer = 0 } = {}) {
@@ -1,4 +1,4 @@
1
- import type { GLTF } from '../types/gltf-types';
1
+ import type { GLTF } from '../types/gltf-json-schema';
2
2
  import type { GLTFLoaderOptions } from '../../gltf-loader';
3
3
  export declare const name = "EXT_meshopt_compression";
4
4
  export declare function decode(gltfData: {
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_meshopt_compression.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/EXT_meshopt_compression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAA+C,MAAM,qBAAqB,CAAC;AAC5F,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAczD,eAAO,MAAM,IAAI,4BAA0B,CAAC;AAE5C,wBAAsB,MAAM,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,EAAE,OAAO,EAAE,iBAAiB,iBAiB9E"}
1
+ {"version":3,"file":"EXT_meshopt_compression.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/EXT_meshopt_compression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAA+C,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAczD,eAAO,MAAM,IAAI,4BAA0B,CAAC;AAE5C,wBAAsB,MAAM,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,EAAE,OAAO,EAAE,iBAAiB,iBAiB9E"}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.decode = exports.name = void 0;
7
- const gltf_scenegraph_1 = __importDefault(require("../api/gltf-scenegraph"));
4
+ const gltf_scenegraph_1 = require("../api/gltf-scenegraph");
8
5
  const meshopt_decoder_1 = require("../../meshopt/meshopt-decoder");
9
6
  // @ts-ignore
10
7
  // eslint-disable-next-line
@@ -16,7 +13,7 @@ const DEFAULT_MESHOPT_OPTIONS = {
16
13
  const EXT_MESHOPT_COMPRESSION = 'EXT_meshopt_compression';
17
14
  exports.name = EXT_MESHOPT_COMPRESSION;
18
15
  async function decode(gltfData, options) {
19
- const scenegraph = new gltf_scenegraph_1.default(gltfData);
16
+ const scenegraph = new gltf_scenegraph_1.GLTFScenegraph(gltfData);
20
17
  if (!options?.gltf?.decompressMeshes) {
21
18
  return;
22
19
  }
@@ -39,7 +36,6 @@ async function decodeMeshoptBufferView(scenegraph, bufferView) {
39
36
  const source = new Uint8Array(buffer.arrayBuffer, buffer.byteOffset + byteOffset, byteLength);
40
37
  const result = new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer, bufferView.byteOffset, bufferView.byteLength);
41
38
  await (0, meshopt_decoder_1.meshoptDecodeGltfBuffer)(result, count, byteStride, source, mode, filter);
42
- return result;
39
+ scenegraph.removeObjectExtension(bufferView, EXT_MESHOPT_COMPRESSION);
43
40
  }
44
- return null;
45
41
  }
@@ -1,4 +1,4 @@
1
- import type { GLTF } from '../types/gltf-types';
1
+ import type { GLTF } from '../types/gltf-json-schema';
2
2
  import type { GLTFLoaderOptions } from '../../gltf-loader';
3
3
  /** Extension name */
4
4
  export declare const name = "EXT_texture_webp";
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_texture_webp.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/EXT_texture_webp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,IAAI,EAAwB,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAOzD,qBAAqB;AACrB,eAAO,MAAM,IAAI,qBAAmB,CAAC;AAErC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CA0BnF"}
1
+ {"version":3,"file":"EXT_texture_webp.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/EXT_texture_webp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,IAAI,EAAwB,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAOzD,qBAAqB;AACrB,eAAO,MAAM,IAAI,qBAAmB,CAAC;AAErC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CA0BnF"}
@@ -2,13 +2,10 @@
2
2
  // GLTF EXTENSION: EXT_TEXTURE_WEBP
3
3
  // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_TEXTURE_WEBP
4
4
  /* eslint-disable camelcase */
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
5
  Object.defineProperty(exports, "__esModule", { value: true });
9
6
  exports.preprocess = exports.name = void 0;
10
7
  const images_1 = require("@loaders.gl/images");
11
- const gltf_scenegraph_1 = __importDefault(require("../api/gltf-scenegraph"));
8
+ const gltf_scenegraph_1 = require("../api/gltf-scenegraph");
12
9
  const EXT_TEXTURE_WEBP = 'EXT_texture_webp';
13
10
  /** Extension name */
14
11
  exports.name = EXT_TEXTURE_WEBP;
@@ -17,7 +14,7 @@ exports.name = EXT_TEXTURE_WEBP;
17
14
  * Done in preprocess() to prevent load of default image
18
15
  */
19
16
  function preprocess(gltfData, options) {
20
- const scenegraph = new gltf_scenegraph_1.default(gltfData);
17
+ const scenegraph = new gltf_scenegraph_1.GLTFScenegraph(gltfData);
21
18
  if (!(0, images_1.isImageFormatSupported)('image/webp')) {
22
19
  if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {
23
20
  throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);
@@ -1,4 +1,4 @@
1
- import type { GLTF } from '../types/gltf-types';
1
+ import type { GLTF } from '../types/gltf-json-schema';
2
2
  /** Extension name */
3
3
  export declare const name = "KHR_binary_glTF";
4
4
  export declare function preprocess(gltfData: {
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_binary_gltf.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/KHR_binary_gltf.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAMpE,qBAAqB;AACrB,eAAO,MAAM,IAAI,oBAAkB,CAAC;AAEpC,wBAAgB,UAAU,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,GAAG,IAAI,CA+BvD"}
1
+ {"version":3,"file":"KHR_binary_gltf.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/KHR_binary_gltf.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,IAAI,EAAuB,MAAM,2BAA2B,CAAC;AAM1E,qBAAqB;AACrB,eAAO,MAAM,IAAI,oBAAkB,CAAC;AAEpC,wBAAgB,UAAU,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,GAAG,IAAI,CA+BvD"}