@loaders.gl/gltf 4.0.0-alpha.4 → 4.0.0-alpha.6
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.
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +5565 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/glb-loader.js +56 -0
- package/dist/es5/glb-loader.js.map +1 -0
- package/dist/es5/glb-writer.js +35 -0
- package/dist/es5/glb-writer.js.map +1 -0
- package/dist/es5/gltf-loader.js +81 -0
- package/dist/es5/gltf-loader.js.map +1 -0
- package/dist/es5/gltf-writer.js +35 -0
- package/dist/es5/gltf-writer.js.map +1 -0
- package/dist/es5/index.js +49 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/api/gltf-extensions.js +109 -0
- package/dist/es5/lib/api/gltf-extensions.js.map +1 -0
- package/dist/es5/lib/api/gltf-scenegraph.js +578 -0
- package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -0
- package/dist/es5/lib/api/normalize-gltf-v1.js +331 -0
- package/dist/es5/lib/api/normalize-gltf-v1.js.map +1 -0
- package/dist/es5/lib/api/post-process-gltf.js +422 -0
- package/dist/es5/lib/api/post-process-gltf.js.map +1 -0
- package/dist/es5/lib/encoders/encode-glb.js +61 -0
- package/dist/es5/lib/encoders/encode-glb.js.map +1 -0
- package/dist/es5/lib/encoders/encode-gltf.js +21 -0
- package/dist/es5/lib/encoders/encode-gltf.js.map +1 -0
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js +96 -0
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -0
- package/dist/es5/lib/extensions/EXT_texture_webp.js +44 -0
- package/dist/es5/lib/extensions/EXT_texture_webp.js.map +1 -0
- package/dist/es5/lib/extensions/KHR_binary_gltf.js +40 -0
- package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -0
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +246 -0
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -0
- package/dist/es5/lib/extensions/KHR_texture_basisu.js +37 -0
- package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +1 -0
- package/dist/es5/lib/extensions/KHR_texture_transform.js +229 -0
- package/dist/es5/lib/extensions/KHR_texture_transform.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +103 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +99 -0
- package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +76 -0
- package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +113 -0
- package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -0
- package/dist/es5/lib/gltf-utils/get-typed-array.js +23 -0
- package/dist/es5/lib/gltf-utils/get-typed-array.js.map +1 -0
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +68 -0
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -0
- package/dist/es5/lib/gltf-utils/gltf-constants.js +48 -0
- package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -0
- package/dist/es5/lib/gltf-utils/gltf-utils.js +62 -0
- package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -0
- package/dist/es5/lib/gltf-utils/resolve-url.js +18 -0
- package/dist/es5/lib/gltf-utils/resolve-url.js.map +1 -0
- package/dist/es5/lib/parsers/parse-glb.js +120 -0
- package/dist/es5/lib/parsers/parse-glb.js.map +1 -0
- package/dist/es5/lib/parsers/parse-gltf.js +287 -0
- package/dist/es5/lib/parsers/parse-gltf.js.map +1 -0
- package/dist/es5/lib/types/glb-types.js +2 -0
- package/dist/es5/lib/types/glb-types.js.map +1 -0
- package/dist/es5/lib/types/gltf-json-schema.js +2 -0
- package/dist/es5/lib/types/gltf-json-schema.js.map +1 -0
- package/dist/es5/lib/types/gltf-postprocessed-schema.js +2 -0
- package/dist/es5/lib/types/gltf-postprocessed-schema.js.map +1 -0
- package/dist/es5/lib/types/gltf-types.js +2 -0
- package/dist/es5/lib/types/gltf-types.js.map +1 -0
- package/dist/es5/lib/utils/assert.js +12 -0
- package/dist/es5/lib/utils/assert.js.map +1 -0
- package/dist/es5/lib/utils/version.js +9 -0
- package/dist/es5/lib/utils/version.js.map +1 -0
- package/dist/es5/meshopt/meshopt-decoder.js +215 -0
- package/dist/es5/meshopt/meshopt-decoder.js.map +1 -0
- package/dist/es5/webp/webp.js +83 -0
- package/dist/es5/webp/webp.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/glb-loader.js +31 -0
- package/dist/esm/glb-loader.js.map +1 -0
- package/dist/esm/glb-writer.js +27 -0
- package/dist/esm/glb-writer.js.map +1 -0
- package/dist/esm/gltf-loader.js +51 -0
- package/dist/esm/gltf-loader.js.map +1 -0
- package/dist/esm/gltf-writer.js +28 -0
- package/dist/esm/gltf-writer.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/api/gltf-extensions.js +35 -0
- package/dist/esm/lib/api/gltf-extensions.js.map +1 -0
- package/dist/esm/lib/api/gltf-scenegraph.js +441 -0
- package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -0
- package/dist/esm/lib/api/normalize-gltf-v1.js +204 -0
- package/dist/esm/lib/api/normalize-gltf-v1.js.map +1 -0
- package/dist/esm/lib/api/post-process-gltf.js +341 -0
- package/dist/esm/lib/api/post-process-gltf.js.map +1 -0
- package/dist/esm/lib/encoders/encode-glb.js +54 -0
- package/dist/esm/lib/encoders/encode-glb.js.map +1 -0
- package/dist/esm/lib/encoders/encode-gltf.js +14 -0
- package/dist/esm/lib/encoders/encode-gltf.js.map +1 -0
- package/dist/esm/lib/extensions/EXT_meshopt_compression.js +42 -0
- package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +1 -0
- package/dist/esm/lib/extensions/EXT_texture_webp.js +25 -0
- package/dist/esm/lib/extensions/EXT_texture_webp.js.map +1 -0
- package/dist/esm/lib/extensions/KHR_binary_gltf.js +21 -0
- package/dist/esm/lib/extensions/KHR_binary_gltf.js.map +1 -0
- package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js +110 -0
- package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js.map +1 -0
- package/dist/esm/lib/extensions/KHR_texture_basisu.js +18 -0
- package/dist/esm/lib/extensions/KHR_texture_basisu.js.map +1 -0
- package/dist/esm/lib/extensions/KHR_texture_transform.js +181 -0
- package/dist/esm/lib/extensions/KHR_texture_transform.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +77 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js +42 -0
- package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js +33 -0
- package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js +61 -0
- package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -0
- package/dist/esm/lib/gltf-utils/get-typed-array.js +16 -0
- package/dist/esm/lib/gltf-utils/get-typed-array.js.map +1 -0
- package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js +62 -0
- package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js.map +1 -0
- package/dist/esm/lib/gltf-utils/gltf-constants.js +37 -0
- package/dist/esm/lib/gltf-utils/gltf-constants.js.map +1 -0
- package/dist/esm/lib/gltf-utils/gltf-utils.js +54 -0
- package/dist/esm/lib/gltf-utils/gltf-utils.js.map +1 -0
- package/dist/esm/lib/gltf-utils/resolve-url.js +12 -0
- package/dist/esm/lib/gltf-utils/resolve-url.js.map +1 -0
- package/dist/esm/lib/parsers/parse-glb.js +114 -0
- package/dist/esm/lib/parsers/parse-glb.js.map +1 -0
- package/dist/esm/lib/parsers/parse-gltf.js +156 -0
- package/dist/esm/lib/parsers/parse-gltf.js.map +1 -0
- package/dist/esm/lib/types/glb-types.js +2 -0
- package/dist/esm/lib/types/glb-types.js.map +1 -0
- package/dist/esm/lib/types/gltf-json-schema.js +2 -0
- package/dist/esm/lib/types/gltf-json-schema.js.map +1 -0
- package/dist/esm/lib/types/gltf-postprocessed-schema.js +2 -0
- package/dist/esm/lib/types/gltf-postprocessed-schema.js.map +1 -0
- package/dist/esm/lib/types/gltf-types.js +2 -0
- package/dist/esm/lib/types/gltf-types.js.map +1 -0
- package/dist/esm/lib/utils/assert.js +6 -0
- package/dist/esm/lib/utils/assert.js.map +1 -0
- package/dist/esm/lib/utils/version.js +2 -0
- package/dist/esm/lib/utils/version.js.map +1 -0
- package/dist/esm/meshopt/meshopt-decoder.js +91 -0
- package/dist/esm/meshopt/meshopt-decoder.js.map +1 -0
- package/dist/esm/meshopt/meshopt-encoder.ts.disabled +409 -0
- package/dist/esm/webp/webp.js +25 -0
- package/dist/esm/webp/webp.js.map +1 -0
- package/dist/glb-loader.d.ts +14 -0
- package/dist/glb-loader.d.ts.map +1 -0
- package/dist/glb-loader.js +33 -28
- package/dist/glb-writer.d.ts +13 -0
- package/dist/glb-writer.d.ts.map +1 -0
- package/dist/glb-writer.js +34 -26
- package/dist/gltf-loader.d.ts +19 -0
- package/dist/gltf-loader.d.ts.map +1 -0
- package/dist/gltf-loader.js +46 -43
- package/dist/gltf-writer.d.ts +25 -0
- package/dist/gltf-writer.d.ts.map +1 -0
- package/dist/gltf-writer.js +29 -26
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -7
- package/dist/lib/api/gltf-extensions.d.ts +31 -0
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -0
- package/dist/lib/api/gltf-extensions.js +79 -31
- package/dist/lib/api/gltf-scenegraph.d.ts +177 -0
- package/dist/lib/api/gltf-scenegraph.d.ts.map +1 -0
- package/dist/lib/api/gltf-scenegraph.js +563 -512
- package/dist/lib/api/normalize-gltf-v1.d.ts +2 -0
- package/dist/lib/api/normalize-gltf-v1.d.ts.map +1 -0
- package/dist/lib/api/normalize-gltf-v1.js +278 -226
- package/dist/lib/api/post-process-gltf.d.ts +2 -0
- package/dist/lib/api/post-process-gltf.d.ts.map +1 -0
- package/dist/lib/api/post-process-gltf.js +324 -346
- package/dist/lib/encoders/encode-glb.d.ts +3 -0
- package/dist/lib/encoders/encode-glb.d.ts.map +1 -0
- package/dist/lib/encoders/encode-glb.js +56 -58
- package/dist/lib/encoders/encode-gltf.d.ts +20 -0
- package/dist/lib/encoders/encode-gltf.d.ts.map +1 -0
- package/dist/lib/encoders/encode-gltf.js +33 -12
- package/dist/lib/extensions/EXT_meshopt_compression.d.ts +7 -0
- package/dist/lib/extensions/EXT_meshopt_compression.d.ts.map +1 -0
- package/dist/lib/extensions/EXT_meshopt_compression.js +39 -50
- package/dist/lib/extensions/EXT_texture_webp.d.ts +12 -0
- package/dist/lib/extensions/EXT_texture_webp.d.ts.map +1 -0
- package/dist/lib/extensions/EXT_texture_webp.js +35 -28
- package/dist/lib/extensions/KHR_binary_gltf.d.ts +7 -0
- package/dist/lib/extensions/KHR_binary_gltf.d.ts.map +1 -0
- package/dist/lib/extensions/KHR_binary_gltf.js +39 -23
- package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts +13 -0
- package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts.map +1 -0
- package/dist/lib/extensions/KHR_draco_mesh_compression.js +126 -111
- package/dist/lib/extensions/KHR_texture_basisu.d.ts +12 -0
- package/dist/lib/extensions/KHR_texture_basisu.d.ts.map +1 -0
- package/dist/lib/extensions/KHR_texture_basisu.js +29 -19
- package/dist/lib/extensions/KHR_texture_transform.d.ts +13 -0
- package/dist/lib/extensions/KHR_texture_transform.d.ts.map +1 -0
- package/dist/lib/extensions/KHR_texture_transform.js +230 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts +6 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +118 -0
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts +7 -0
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.js +57 -44
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts +7 -0
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +42 -32
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts +7 -0
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +76 -62
- package/dist/lib/gltf-utils/get-typed-array.d.ts +3 -0
- package/dist/lib/gltf-utils/get-typed-array.d.ts.map +1 -0
- package/dist/lib/gltf-utils/get-typed-array.js +39 -14
- package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts +6 -0
- package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts.map +1 -0
- package/dist/lib/gltf-utils/gltf-attribute-utils.js +65 -65
- package/dist/lib/gltf-utils/gltf-constants.d.ts +21 -0
- package/dist/lib/gltf-utils/gltf-constants.d.ts.map +1 -0
- package/dist/lib/gltf-utils/gltf-constants.js +38 -32
- package/dist/lib/gltf-utils/gltf-utils.d.ts +8 -0
- package/dist/lib/gltf-utils/gltf-utils.d.ts.map +1 -0
- package/dist/lib/gltf-utils/gltf-utils.js +52 -45
- package/dist/lib/gltf-utils/resolve-url.d.ts +2 -0
- package/dist/lib/gltf-utils/resolve-url.d.ts.map +1 -0
- package/dist/lib/gltf-utils/resolve-url.js +17 -15
- package/dist/lib/parsers/parse-glb.d.ts +8 -0
- package/dist/lib/parsers/parse-glb.d.ts.map +1 -0
- package/dist/lib/parsers/parse-glb.js +120 -107
- package/dist/lib/parsers/parse-gltf.d.ts +14 -0
- package/dist/lib/parsers/parse-gltf.d.ts.map +1 -0
- package/dist/lib/parsers/parse-gltf.js +187 -154
- package/dist/lib/types/glb-types.d.ts +17 -0
- package/dist/lib/types/glb-types.d.ts.map +1 -0
- package/dist/lib/types/glb-types.js +2 -2
- package/dist/lib/types/gltf-json-schema.d.ts +1105 -0
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -0
- package/dist/lib/types/gltf-json-schema.js +4 -2
- package/dist/lib/types/gltf-postprocessed-schema.d.ts +686 -0
- package/dist/lib/types/gltf-postprocessed-schema.d.ts.map +1 -0
- package/dist/lib/types/gltf-postprocessed-schema.js +4 -2
- package/dist/lib/types/gltf-types.d.ts +14 -0
- package/dist/lib/types/gltf-types.d.ts.map +1 -0
- package/dist/lib/types/gltf-types.js +3 -2
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +11 -5
- package/dist/lib/utils/version.d.ts +2 -0
- package/dist/lib/utils/version.d.ts.map +1 -0
- package/dist/lib/utils/version.js +7 -2
- package/dist/meshopt/meshopt-decoder.d.ts +6 -0
- package/dist/meshopt/meshopt-decoder.d.ts.map +1 -0
- package/dist/meshopt/meshopt-decoder.js +97 -82
- package/dist/webp/webp.d.ts +7 -0
- package/dist/webp/webp.d.ts.map +1 -0
- package/dist/webp/webp.js +32 -23
- package/package.json +11 -13
- package/src/glb-loader.ts +1 -1
- package/src/glb-writer.ts +9 -3
- package/src/gltf-writer.ts +2 -2
- package/src/index.ts +11 -1
- package/src/lib/api/gltf-extensions.ts +13 -2
- package/src/lib/api/gltf-scenegraph.ts +23 -14
- package/src/lib/api/{normalize-gltf-v1.js → normalize-gltf-v1.ts} +20 -17
- package/src/lib/api/{post-process-gltf.js → post-process-gltf.ts} +52 -9
- package/src/lib/encoders/{encode-glb.js → encode-glb.ts} +8 -1
- package/src/lib/encoders/encode-gltf.ts +34 -0
- package/src/lib/extensions/EXT_meshopt_compression.ts +12 -19
- package/src/lib/extensions/EXT_texture_webp.ts +3 -2
- package/src/lib/extensions/KHR_binary_gltf.ts +1 -1
- package/src/lib/extensions/KHR_draco_mesh_compression.ts +1 -1
- package/src/lib/extensions/KHR_texture_basisu.ts +3 -2
- package/src/lib/extensions/KHR_texture_transform.ts +305 -0
- package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +163 -0
- package/src/lib/extensions/deprecated/KHR_materials_unlit.ts +3 -3
- package/src/lib/extensions/deprecated/KHR_techniques_webgl.ts +1 -0
- package/src/lib/gltf-utils/gltf-constants.ts +2 -2
- package/src/lib/parsers/parse-gltf.ts +12 -3
- package/src/lib/types/glb-types.ts +1 -1
- package/src/lib/types/gltf-json-schema.ts +434 -5
- package/src/lib/types/gltf-postprocessed-schema.ts +12 -11
- package/src/lib/types/gltf-types.ts +26 -2
- package/src/lib/utils/{assert.js → assert.ts} +1 -1
- package/dist/bundle.js.map +0 -1
- package/dist/glb-loader.js.map +0 -1
- package/dist/glb-writer.js.map +0 -1
- package/dist/gltf-loader.js.map +0 -1
- package/dist/gltf-writer.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/api/gltf-extensions.js.map +0 -1
- package/dist/lib/api/gltf-scenegraph.js.map +0 -1
- package/dist/lib/api/normalize-gltf-v1.js.map +0 -1
- package/dist/lib/api/post-process-gltf.js.map +0 -1
- package/dist/lib/encoders/encode-glb.js.map +0 -1
- package/dist/lib/encoders/encode-gltf.js.map +0 -1
- package/dist/lib/extensions/EXT_meshopt_compression.js.map +0 -1
- package/dist/lib/extensions/EXT_texture_webp.js.map +0 -1
- package/dist/lib/extensions/KHR_binary_gltf.js.map +0 -1
- package/dist/lib/extensions/KHR_draco_mesh_compression.js.map +0 -1
- package/dist/lib/extensions/KHR_texture_basisu.js.map +0 -1
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.js.map +0 -1
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js.map +0 -1
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js.map +0 -1
- package/dist/lib/gltf-utils/get-typed-array.js.map +0 -1
- package/dist/lib/gltf-utils/gltf-attribute-utils.js.map +0 -1
- package/dist/lib/gltf-utils/gltf-constants.js.map +0 -1
- package/dist/lib/gltf-utils/gltf-utils.js.map +0 -1
- package/dist/lib/gltf-utils/resolve-url.js.map +0 -1
- package/dist/lib/parsers/parse-glb.js.map +0 -1
- package/dist/lib/parsers/parse-gltf.js.map +0 -1
- package/dist/lib/types/glb-types.js.map +0 -1
- package/dist/lib/types/gltf-json-schema.js.map +0 -1
- package/dist/lib/types/gltf-postprocessed-schema.js.map +0 -1
- package/dist/lib/types/gltf-types.js.map +0 -1
- package/dist/lib/utils/assert.js.map +0 -1
- package/dist/lib/utils/version.js.map +0 -1
- package/dist/meshopt/meshopt-decoder.js.map +0 -1
- package/dist/webp/webp.js.map +0 -1
- package/src/lib/encoders/encode-gltf.js +0 -25
- /package/dist/{meshopt → es5/meshopt}/meshopt-encoder.ts.disabled +0 -0
- /package/src/lib/utils/{version.js → version.ts} +0 -0
|
@@ -10,7 +10,8 @@ import type {
|
|
|
10
10
|
GLTFTexture,
|
|
11
11
|
GLTFImage,
|
|
12
12
|
GLTFBuffer,
|
|
13
|
-
GLTFBufferView
|
|
13
|
+
GLTFBufferView,
|
|
14
|
+
GLTFWithBuffers
|
|
14
15
|
} from '../types/gltf-types';
|
|
15
16
|
|
|
16
17
|
import {getBinaryImageMetadata} from '@loaders.gl/images';
|
|
@@ -22,12 +23,6 @@ import {
|
|
|
22
23
|
getComponentTypeFromArray
|
|
23
24
|
} from '../gltf-utils/gltf-utils';
|
|
24
25
|
|
|
25
|
-
type GLTFWithBuffers = {
|
|
26
|
-
json: GLTF;
|
|
27
|
-
buffers: any[];
|
|
28
|
-
binary?: ArrayBuffer;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
26
|
const DEFAULT_GLTF_JSON: GLTF = {
|
|
32
27
|
asset: {
|
|
33
28
|
version: '2.0',
|
|
@@ -68,13 +63,13 @@ export default class GLTFScenegraph {
|
|
|
68
63
|
return this.gltf.json;
|
|
69
64
|
}
|
|
70
65
|
|
|
71
|
-
getApplicationData(key: string):
|
|
66
|
+
getApplicationData(key: string): unknown {
|
|
72
67
|
// TODO - Data is already unpacked by GLBParser
|
|
73
68
|
const data = this.json[key];
|
|
74
69
|
return data;
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
getExtraData(key: string): {[key: string]:
|
|
72
|
+
getExtraData(key: string): {[key: string]: unknown} {
|
|
78
73
|
// TODO - Data is already unpacked by GLBParser
|
|
79
74
|
const extras = this.json.extras || {};
|
|
80
75
|
return extras[key];
|
|
@@ -99,6 +94,10 @@ export default class GLTFScenegraph {
|
|
|
99
94
|
return this.json.extensionsUsed || [];
|
|
100
95
|
}
|
|
101
96
|
|
|
97
|
+
getRemovedExtensions(): string[] {
|
|
98
|
+
return (this.json.extensionsRemoved || []) as string[];
|
|
99
|
+
}
|
|
100
|
+
|
|
102
101
|
getObjectExtension<T = Extension>(object: {[key: string]: any}, extensionName: string): T | null {
|
|
103
102
|
const extensions = object.extensions || {};
|
|
104
103
|
return extensions[extensionName];
|
|
@@ -157,7 +156,7 @@ export default class GLTFScenegraph {
|
|
|
157
156
|
if (typeof index === 'object') {
|
|
158
157
|
return index;
|
|
159
158
|
}
|
|
160
|
-
const object = this.json[array] && this.json[array][index];
|
|
159
|
+
const object = this.json[array] && (this.json[array] as {}[])[index];
|
|
161
160
|
if (!object) {
|
|
162
161
|
throw new Error(`glTF file error: Could not find ${array}[${index}]`); // eslint-disable-line
|
|
163
162
|
}
|
|
@@ -234,7 +233,7 @@ export default class GLTFScenegraph {
|
|
|
234
233
|
*/
|
|
235
234
|
addExtraData(key: string, data: object): GLTFScenegraph {
|
|
236
235
|
this.json.extras = this.json.extras || {};
|
|
237
|
-
this.json.extras[key] = data;
|
|
236
|
+
(this.json.extras as Record<string, unknown>)[key] = data;
|
|
238
237
|
return this;
|
|
239
238
|
}
|
|
240
239
|
|
|
@@ -269,7 +268,7 @@ export default class GLTFScenegraph {
|
|
|
269
268
|
addExtension(extensionName: string, extensionData: object = {}): object {
|
|
270
269
|
assert(extensionData);
|
|
271
270
|
this.json.extensions = this.json.extensions || {};
|
|
272
|
-
this.json.extensions[extensionName] = extensionData;
|
|
271
|
+
(this.json.extensions as Record<string, unknown>)[extensionName] = extensionData;
|
|
273
272
|
this.registerUsedExtension(extensionName);
|
|
274
273
|
return extensionData;
|
|
275
274
|
}
|
|
@@ -309,6 +308,9 @@ export default class GLTFScenegraph {
|
|
|
309
308
|
* Removes an extension from the top-level list
|
|
310
309
|
*/
|
|
311
310
|
removeExtension(extensionName: string): void {
|
|
311
|
+
if (!this.getExtension(extensionName)) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
312
314
|
if (this.json.extensionsRequired) {
|
|
313
315
|
this._removeStringFromArray(this.json.extensionsRequired, extensionName);
|
|
314
316
|
}
|
|
@@ -318,6 +320,13 @@ export default class GLTFScenegraph {
|
|
|
318
320
|
if (this.json.extensions) {
|
|
319
321
|
delete this.json.extensions[extensionName];
|
|
320
322
|
}
|
|
323
|
+
if (!Array.isArray(this.json.extensionsRemoved)) {
|
|
324
|
+
this.json.extensionsRemoved = [];
|
|
325
|
+
}
|
|
326
|
+
const extensionsRemoved = this.json.extensionsRemoved as string[];
|
|
327
|
+
if (!extensionsRemoved.includes(extensionName)) {
|
|
328
|
+
extensionsRemoved.push(extensionName);
|
|
329
|
+
}
|
|
321
330
|
}
|
|
322
331
|
|
|
323
332
|
/**
|
|
@@ -344,7 +353,7 @@ export default class GLTFScenegraph {
|
|
|
344
353
|
* `name`, `extensions`, `extras`, `camera`, `children`, `skin`, `rotation`, `scale`, `translation`, `weights`
|
|
345
354
|
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#node
|
|
346
355
|
*/
|
|
347
|
-
addNode(node: {meshIndex: number; matrix
|
|
356
|
+
addNode(node: {meshIndex: number; matrix?: number[]}): number {
|
|
348
357
|
const {meshIndex, matrix} = node;
|
|
349
358
|
this.json.nodes = this.json.nodes || [];
|
|
350
359
|
const nodeData = {mesh: meshIndex};
|
|
@@ -357,7 +366,7 @@ export default class GLTFScenegraph {
|
|
|
357
366
|
}
|
|
358
367
|
|
|
359
368
|
/** Adds a mesh to the json part */
|
|
360
|
-
addMesh(mesh: {attributes: object; indices
|
|
369
|
+
addMesh(mesh: {attributes: object; indices?: object; material?: number; mode?: number}): number {
|
|
361
370
|
const {attributes, indices, material, mode = 4} = mesh;
|
|
362
371
|
const accessors = this._addAttributes(attributes);
|
|
363
372
|
|
|
@@ -80,22 +80,24 @@ const GLTF_KEYS = {
|
|
|
80
80
|
* Converts (normalizes) glTF v1 to v2
|
|
81
81
|
*/
|
|
82
82
|
class GLTFV1Normalizer {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
idToIndexMap = {
|
|
84
|
+
animations: {},
|
|
85
|
+
accessors: {},
|
|
86
|
+
buffers: {},
|
|
87
|
+
bufferViews: {},
|
|
88
|
+
images: {},
|
|
89
|
+
materials: {},
|
|
90
|
+
meshes: {},
|
|
91
|
+
nodes: {},
|
|
92
|
+
samplers: {},
|
|
93
|
+
scenes: {},
|
|
94
|
+
skins: {},
|
|
95
|
+
textures: {}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
json;
|
|
99
|
+
|
|
100
|
+
// constructor() {}
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* Convert (normalize) glTF < 2.0 to glTF 2.0
|
|
@@ -296,7 +298,8 @@ class GLTFV1Normalizer {
|
|
|
296
298
|
roughnessFactor: 1
|
|
297
299
|
};
|
|
298
300
|
|
|
299
|
-
const textureId =
|
|
301
|
+
const textureId =
|
|
302
|
+
material.values?.tex || material.values?.texture2d_0 || material.values?.diffuseTex;
|
|
300
303
|
const textureIndex = json.textures.findIndex((texture) => texture.id === textureId);
|
|
301
304
|
if (textureIndex !== -1) {
|
|
302
305
|
material.pbrMetallicRoughness.baseColorTexture = {index: textureIndex};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {assert} from '../utils/assert';
|
|
2
2
|
import {getAccessorArrayTypeAndLength} from '../gltf-utils/gltf-utils';
|
|
3
|
+
import {BufferView} from '../types/gltf-json-schema';
|
|
4
|
+
import {BufferView as BufferViewPostprocessed} from '../types/gltf-postprocessed-schema';
|
|
3
5
|
|
|
4
6
|
// This is a post processor for loaded glTF files
|
|
5
7
|
// The goal is to make the loaded data easier to use in WebGL applications
|
|
@@ -56,7 +58,7 @@ const DEFAULT_SAMPLER = {
|
|
|
56
58
|
[GL_SAMPLER.TEXTURE_MAG_FILTER]: GL_SAMPLER.LINEAR,
|
|
57
59
|
[GL_SAMPLER.TEXTURE_MIN_FILTER]: GL_SAMPLER.NEAREST_MIPMAP_LINEAR,
|
|
58
60
|
[GL_SAMPLER.TEXTURE_WRAP_S]: GL_SAMPLER.REPEAT,
|
|
59
|
-
[GL_SAMPLER.
|
|
61
|
+
[GL_SAMPLER.TEXTURE_WRAP_T]: GL_SAMPLER.REPEAT
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
function getBytesFromComponentType(componentType) {
|
|
@@ -68,6 +70,11 @@ function getSizeFromAccessorType(type) {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
class GLTFPostProcessor {
|
|
73
|
+
baseUri: string = '';
|
|
74
|
+
json: Record<string, any> = {};
|
|
75
|
+
buffers: [] = [];
|
|
76
|
+
images: [] = [];
|
|
77
|
+
|
|
71
78
|
postProcess(gltf, options = {}) {
|
|
72
79
|
const {json, buffers = [], images = [], baseUri = ''} = gltf;
|
|
73
80
|
assert(json);
|
|
@@ -303,13 +310,44 @@ class GLTFPostProcessor {
|
|
|
303
310
|
const {ArrayType, byteLength} = getAccessorArrayTypeAndLength(accessor, accessor.bufferView);
|
|
304
311
|
const byteOffset =
|
|
305
312
|
(accessor.bufferView.byteOffset || 0) + (accessor.byteOffset || 0) + buffer.byteOffset;
|
|
306
|
-
|
|
307
|
-
accessor.
|
|
313
|
+
let cutBuffer = buffer.arrayBuffer.slice(byteOffset, byteOffset + byteLength);
|
|
314
|
+
if (accessor.bufferView.byteStride) {
|
|
315
|
+
cutBuffer = this._getValueFromInterleavedBuffer(
|
|
316
|
+
buffer,
|
|
317
|
+
byteOffset,
|
|
318
|
+
accessor.bufferView.byteStride,
|
|
319
|
+
accessor.bytesPerElement,
|
|
320
|
+
accessor.count
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
accessor.value = new ArrayType(cutBuffer);
|
|
308
324
|
}
|
|
309
325
|
|
|
310
326
|
return accessor;
|
|
311
327
|
}
|
|
312
328
|
|
|
329
|
+
/**
|
|
330
|
+
* Take values of particular accessor from interleaved buffer
|
|
331
|
+
* various parts of the buffer
|
|
332
|
+
* @param buffer
|
|
333
|
+
* @param byteOffset
|
|
334
|
+
* @param byteStride
|
|
335
|
+
* @param bytesPerElement
|
|
336
|
+
* @param count
|
|
337
|
+
* @returns
|
|
338
|
+
*/
|
|
339
|
+
_getValueFromInterleavedBuffer(buffer, byteOffset, byteStride, bytesPerElement, count) {
|
|
340
|
+
const result = new Uint8Array(count * bytesPerElement);
|
|
341
|
+
for (let i = 0; i < count; i++) {
|
|
342
|
+
const elementOffset = byteOffset + i * byteStride;
|
|
343
|
+
result.set(
|
|
344
|
+
new Uint8Array(buffer.arrayBuffer.slice(elementOffset, elementOffset + bytesPerElement)),
|
|
345
|
+
i * bytesPerElement
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
return result.buffer;
|
|
349
|
+
}
|
|
350
|
+
|
|
313
351
|
_resolveTexture(texture, index) {
|
|
314
352
|
// texture = {...texture};
|
|
315
353
|
texture.id = texture.id || `texture-${index}`;
|
|
@@ -353,21 +391,26 @@ class GLTFPostProcessor {
|
|
|
353
391
|
return image;
|
|
354
392
|
}
|
|
355
393
|
|
|
356
|
-
_resolveBufferView(bufferView, index) {
|
|
394
|
+
_resolveBufferView(bufferView: BufferView, index: number): BufferViewPostprocessed {
|
|
357
395
|
// bufferView = {...bufferView};
|
|
358
|
-
bufferView.id = bufferView.id || `bufferView-${index}`;
|
|
359
396
|
const bufferIndex = bufferView.buffer;
|
|
360
|
-
|
|
397
|
+
const result: BufferViewPostprocessed = {
|
|
398
|
+
id: `bufferView-${index}`,
|
|
399
|
+
...bufferView,
|
|
400
|
+
buffer: this.buffers[bufferIndex]
|
|
401
|
+
};
|
|
361
402
|
|
|
403
|
+
// @ts-expect-error
|
|
362
404
|
const arrayBuffer = this.buffers[bufferIndex].arrayBuffer;
|
|
405
|
+
// @ts-expect-error
|
|
363
406
|
let byteOffset = this.buffers[bufferIndex].byteOffset || 0;
|
|
364
407
|
|
|
365
408
|
if ('byteOffset' in bufferView) {
|
|
366
409
|
byteOffset += bufferView.byteOffset;
|
|
367
410
|
}
|
|
368
411
|
|
|
369
|
-
|
|
370
|
-
return
|
|
412
|
+
result.data = new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);
|
|
413
|
+
return result;
|
|
371
414
|
}
|
|
372
415
|
|
|
373
416
|
_resolveCamera(camera, index) {
|
|
@@ -383,6 +426,6 @@ class GLTFPostProcessor {
|
|
|
383
426
|
}
|
|
384
427
|
}
|
|
385
428
|
|
|
386
|
-
export function postProcessGLTF(gltf, options) {
|
|
429
|
+
export function postProcessGLTF(gltf, options?) {
|
|
387
430
|
return new GLTFPostProcessor().postProcess(gltf, options);
|
|
388
431
|
}
|
|
@@ -10,10 +10,17 @@ const MAGIC_BIN = 0x004e4942; // BIN\0 in ASCII
|
|
|
10
10
|
|
|
11
11
|
const LE = true; // Binary GLTF is little endian.
|
|
12
12
|
|
|
13
|
+
export type GLBEncodeOptions = {};
|
|
14
|
+
|
|
13
15
|
// Encode the full GLB buffer with header etc
|
|
14
16
|
// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#
|
|
15
17
|
// glb-file-format-specification
|
|
16
|
-
export default function encodeGLBSync(
|
|
18
|
+
export default function encodeGLBSync(
|
|
19
|
+
glb,
|
|
20
|
+
dataView,
|
|
21
|
+
byteOffset = 0,
|
|
22
|
+
options: GLBEncodeOptions = {}
|
|
23
|
+
) {
|
|
17
24
|
const {magic = MAGIC_glTF, version = 2, json = {}, binary} = glb;
|
|
18
25
|
|
|
19
26
|
const byteOffsetStart = byteOffset;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import encodeGLBSync from './encode-glb';
|
|
2
|
+
|
|
3
|
+
export type GLTFEncodeOptions = Record<string, any>;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Encode the full glTF file as a binary GLB file
|
|
7
|
+
* Returns an ArrayBuffer that represents the complete GLB image that can be saved to file
|
|
8
|
+
*
|
|
9
|
+
* @todo - Does not support encoding to non-GLB versions of glTF format. Other formats
|
|
10
|
+
* - Encode as a textual JSON file with binary data in base64 data URLs.
|
|
11
|
+
* - Encode as a JSON with all images (and buffers?) in separate binary files
|
|
12
|
+
*
|
|
13
|
+
* glb-file-format-specification
|
|
14
|
+
* @see https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#
|
|
15
|
+
*
|
|
16
|
+
* @param gltf
|
|
17
|
+
* @param arrayBuffer
|
|
18
|
+
* @param byteOffset
|
|
19
|
+
* @param options
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export function encodeGLTFSync(gltf, arrayBuffer, byteOffset, options) {
|
|
23
|
+
convertBuffersToBase64(gltf);
|
|
24
|
+
|
|
25
|
+
// TODO: Copy buffers to binary
|
|
26
|
+
|
|
27
|
+
return encodeGLBSync(gltf, arrayBuffer, byteOffset, options);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function convertBuffersToBase64(gltf, {firstBuffer = 0} = {}) {
|
|
31
|
+
if (gltf.buffers && gltf.buffers.length > firstBuffer) {
|
|
32
|
+
throw new Error('encodeGLTF: multiple buffers not yet implemented');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type {GLTF, GLTFBufferView, GLTF_EXT_meshopt_compression} from '../types/gltf-types';
|
|
3
3
|
import type {GLTFLoaderOptions} from '../../gltf-loader';
|
|
4
4
|
import GLTFScenegraph from '../api/gltf-scenegraph';
|
|
5
|
-
import {
|
|
5
|
+
import {meshoptDecodeGltfBuffer} from '../../meshopt/meshopt-decoder';
|
|
6
6
|
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
// eslint-disable-next-line
|
|
@@ -16,16 +16,6 @@ const EXT_MESHOPT_COMPRESSION = 'EXT_meshopt_compression';
|
|
|
16
16
|
|
|
17
17
|
export const name = EXT_MESHOPT_COMPRESSION;
|
|
18
18
|
|
|
19
|
-
export function preprocess(gltfData: {json: GLTF}) {
|
|
20
|
-
const scenegraph = new GLTFScenegraph(gltfData);
|
|
21
|
-
if (
|
|
22
|
-
scenegraph.getRequiredExtensions().includes(EXT_MESHOPT_COMPRESSION) &&
|
|
23
|
-
!isMeshoptSupported()
|
|
24
|
-
) {
|
|
25
|
-
throw new Error(`gltf: Required extension ${EXT_MESHOPT_COMPRESSION} not supported by browser`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
19
|
export async function decode(gltfData: {json: GLTF}, options: GLTFLoaderOptions) {
|
|
30
20
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
31
21
|
|
|
@@ -41,7 +31,7 @@ export async function decode(gltfData: {json: GLTF}, options: GLTFLoaderOptions)
|
|
|
41
31
|
// Decompress meshes in parallel
|
|
42
32
|
await Promise.all(promises);
|
|
43
33
|
|
|
44
|
-
// We have now decompressed all primitives, so remove the top-level
|
|
34
|
+
// We have now decompressed all primitives, so remove the top-level extension
|
|
45
35
|
scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);
|
|
46
36
|
}
|
|
47
37
|
|
|
@@ -55,21 +45,24 @@ async function decodeMeshoptBufferView(
|
|
|
55
45
|
EXT_MESHOPT_COMPRESSION
|
|
56
46
|
);
|
|
57
47
|
if (meshoptExtension) {
|
|
58
|
-
const buffer = bufferView.buffer;
|
|
59
|
-
|
|
60
48
|
const {
|
|
61
49
|
byteOffset = 0,
|
|
62
50
|
byteLength = 0,
|
|
63
51
|
byteStride,
|
|
64
52
|
count,
|
|
65
53
|
mode,
|
|
66
|
-
filter = 'NONE'
|
|
54
|
+
filter = 'NONE',
|
|
55
|
+
buffer: bufferIndex
|
|
67
56
|
} = meshoptExtension;
|
|
57
|
+
const buffer = scenegraph.gltf.buffers[bufferIndex];
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
const source = new Uint8Array(buffer.arrayBuffer, buffer.byteOffset + byteOffset, byteLength);
|
|
60
|
+
const result = new Uint8Array(
|
|
61
|
+
scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,
|
|
62
|
+
bufferView.byteOffset,
|
|
63
|
+
bufferView.byteLength
|
|
64
|
+
);
|
|
65
|
+
await meshoptDecodeGltfBuffer(result, count, byteStride, source, mode, filter);
|
|
73
66
|
return result;
|
|
74
67
|
}
|
|
75
68
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type {GLTF, GLTF_EXT_texture_webp} from '../types/gltf-types';
|
|
6
6
|
import type {GLTFLoaderOptions} from '../../gltf-loader';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {isImageFormatSupported} from '@loaders.gl/images';
|
|
9
9
|
import GLTFScenegraph from '../api/gltf-scenegraph';
|
|
10
10
|
|
|
11
11
|
const EXT_TEXTURE_WEBP = 'EXT_texture_webp';
|
|
@@ -20,7 +20,7 @@ export const name = EXT_TEXTURE_WEBP;
|
|
|
20
20
|
export function preprocess(gltfData: {json: GLTF}, options: GLTFLoaderOptions): void {
|
|
21
21
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
22
22
|
|
|
23
|
-
if (!
|
|
23
|
+
if (!isImageFormatSupported('image/webp')) {
|
|
24
24
|
if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {
|
|
25
25
|
throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);
|
|
26
26
|
}
|
|
@@ -35,6 +35,7 @@ export function preprocess(gltfData: {json: GLTF}, options: GLTFLoaderOptions):
|
|
|
35
35
|
EXT_TEXTURE_WEBP
|
|
36
36
|
);
|
|
37
37
|
if (extension) {
|
|
38
|
+
// TODO - if multiple texture extensions are present which one wins?
|
|
38
39
|
texture.source = extension.source;
|
|
39
40
|
}
|
|
40
41
|
scenegraph.removeObjectExtension(texture, EXT_TEXTURE_WEBP);
|
|
@@ -40,7 +40,7 @@ export function preprocess(gltfData: {json: GLTF}): void {
|
|
|
40
40
|
delete json.buffers[0].uri;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// Remove the top-level extension as it has now been
|
|
43
|
+
// Remove the top-level extension as it has now been processed
|
|
44
44
|
gltfScenegraph.removeExtension(KHR_BINARY_GLTF);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -56,7 +56,7 @@ export async function decode(
|
|
|
56
56
|
// Decompress meshes in parallel
|
|
57
57
|
await Promise.all(promises);
|
|
58
58
|
|
|
59
|
-
// We have now decompressed all primitives, so remove the top-level
|
|
59
|
+
// We have now decompressed all primitives, so remove the top-level extension
|
|
60
60
|
scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// GLTF EXTENSION:
|
|
2
|
-
// https://github.com/KhronosGroup/glTF/tree/
|
|
1
|
+
// GLTF EXTENSION: KHR_texture_basisu
|
|
2
|
+
// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_basisu
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
|
|
5
5
|
import type {GLTF, GLTF_KHR_texture_basisu} from '../types/gltf-types';
|
|
@@ -26,6 +26,7 @@ export function preprocess(gltfData: {json: GLTF}, options: GLTFLoaderOptions):
|
|
|
26
26
|
KHR_TEXTURE_BASISU
|
|
27
27
|
);
|
|
28
28
|
if (extension) {
|
|
29
|
+
// TODO - if multiple texture extensions are present which one wins?
|
|
29
30
|
texture.source = extension.source;
|
|
30
31
|
}
|
|
31
32
|
scene.removeObjectExtension(texture, KHR_TEXTURE_BASISU);
|