@loaders.gl/gltf 4.0.0-alpha.5 → 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.js +2 -2
- package/dist/dist.min.js +2037 -1013
- 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 +3 -2
- package/dist/glb-loader.d.ts.map +1 -1
- package/dist/glb-loader.js +33 -28
- package/dist/glb-writer.d.ts +7 -16
- package/dist/glb-writer.d.ts.map +1 -1
- package/dist/glb-writer.js +34 -26
- package/dist/gltf-loader.d.ts +3 -2
- package/dist/gltf-loader.d.ts.map +1 -1
- package/dist/gltf-loader.js +46 -43
- package/dist/gltf-writer.d.ts +2 -2
- package/dist/gltf-writer.d.ts.map +1 -1
- package/dist/gltf-writer.js +29 -26
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -7
- package/dist/lib/api/gltf-extensions.d.ts +6 -1
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.js +79 -31
- package/dist/lib/api/gltf-scenegraph.d.ts +5 -11
- package/dist/lib/api/gltf-scenegraph.d.ts.map +1 -1
- package/dist/lib/api/gltf-scenegraph.js +563 -512
- package/dist/lib/api/normalize-gltf-v1.d.ts.map +1 -1
- package/dist/lib/api/normalize-gltf-v1.js +278 -229
- package/dist/lib/api/post-process-gltf.js +324 -376
- package/dist/lib/encoders/encode-glb.d.ts +2 -1
- package/dist/lib/encoders/encode-glb.d.ts.map +1 -1
- package/dist/lib/encoders/encode-glb.js +56 -58
- package/dist/lib/encoders/encode-gltf.d.ts +18 -0
- package/dist/lib/encoders/encode-gltf.d.ts.map +1 -1
- package/dist/lib/encoders/encode-gltf.js +33 -12
- package/dist/lib/extensions/EXT_meshopt_compression.d.ts +0 -3
- package/dist/lib/extensions/EXT_meshopt_compression.d.ts.map +1 -1
- package/dist/lib/extensions/EXT_meshopt_compression.js +39 -50
- package/dist/lib/extensions/EXT_texture_webp.d.ts.map +1 -1
- package/dist/lib/extensions/EXT_texture_webp.js +35 -28
- package/dist/lib/extensions/KHR_binary_gltf.js +39 -23
- package/dist/lib/extensions/KHR_draco_mesh_compression.js +126 -111
- package/dist/lib/extensions/KHR_texture_basisu.d.ts.map +1 -1
- 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.js +57 -44
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +42 -32
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts.map +1 -1
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +76 -62
- package/dist/lib/gltf-utils/get-typed-array.js +39 -14
- package/dist/lib/gltf-utils/gltf-attribute-utils.js +65 -65
- package/dist/lib/gltf-utils/gltf-constants.d.ts +17 -0
- package/dist/lib/gltf-utils/gltf-constants.d.ts.map +1 -1
- package/dist/lib/gltf-utils/gltf-constants.js +38 -32
- package/dist/lib/gltf-utils/gltf-utils.js +52 -45
- package/dist/lib/gltf-utils/resolve-url.js +17 -15
- package/dist/lib/parsers/parse-glb.d.ts +1 -1
- package/dist/lib/parsers/parse-glb.d.ts.map +1 -1
- package/dist/lib/parsers/parse-glb.js +120 -107
- package/dist/lib/parsers/parse-gltf.d.ts +2 -2
- package/dist/lib/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-gltf.js +187 -154
- package/dist/lib/types/glb-types.d.ts +3 -3
- package/dist/lib/types/glb-types.d.ts.map +1 -1
- package/dist/lib/types/glb-types.js +2 -2
- package/dist/lib/types/gltf-json-schema.d.ts +396 -11
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/lib/types/gltf-json-schema.js +4 -2
- package/dist/lib/types/gltf-postprocessed-schema.d.ts +10 -10
- package/dist/lib/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/lib/types/gltf-postprocessed-schema.js +4 -2
- package/dist/lib/types/gltf-types.d.ts +8 -5
- package/dist/lib/types/gltf-types.d.ts.map +1 -1
- package/dist/lib/types/gltf-types.js +3 -2
- package/dist/lib/utils/assert.js +11 -5
- package/dist/lib/utils/version.js +7 -2
- package/dist/meshopt/meshopt-decoder.js +97 -82
- package/dist/webp/webp.d.ts +1 -1
- package/dist/webp/webp.d.ts.map +1 -1
- package/dist/webp/webp.js +32 -23
- package/package.json +9 -8
- 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 +10 -1
- package/src/lib/api/gltf-extensions.ts +13 -2
- package/src/lib/api/gltf-scenegraph.ts +21 -12
- package/src/lib/api/normalize-gltf-v1.ts +2 -1
- package/src/lib/encoders/encode-glb.ts +8 -1
- package/src/lib/encoders/encode-gltf.ts +18 -9
- 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 +1 -0
- 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 +10 -1
- 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 +9 -9
- package/src/lib/types/gltf-types.ts +24 -3
- 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/dist/{meshopt → es5/meshopt}/meshopt-encoder.ts.disabled +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-glb.js","names":["padToNBytes","assert","MAGIC_glTF","GLB_FILE_HEADER_SIZE","GLB_CHUNK_HEADER_SIZE","GLB_CHUNK_TYPE_JSON","GLB_CHUNK_TYPE_BIN","GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED","GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED","GLB_V1_CONTENT_FORMAT_JSON","LE","getMagicString","dataView","byteOffset","arguments","length","undefined","concat","String","fromCharCode","getUint8","isGLB","arrayBuffer","options","DataView","magic","magic1","getUint32","parseGLBSync","glb","type","version","byteLength","Object","assign","header","hasBinChunk","json","binChunks","parseGLBV1","parseGLBV2","Error","contentLength","contentFormat","parseJSONChunk","parseBINChunk","parseGLBChunksSync","chunkLength","chunkFormat","strict","jsonChunk","Uint8Array","buffer","textDecoder","TextDecoder","jsonText","decode","JSON","parse","push"],"sources":["../../../../src/lib/parsers/parse-glb.ts"],"sourcesContent":["/* eslint-disable camelcase, max-statements */\n// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#glb-file-format-specification\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\nimport type {GLB} from '../types/glb-types';\nimport {padToNBytes, assert} from '@loaders.gl/loader-utils';\n\nexport type GLBParseOptions = {\n magic?: number;\n strict?: boolean;\n};\n\nconst MAGIC_glTF = 0x676c5446; // glTF in Big-Endian ASCII\n\nconst GLB_FILE_HEADER_SIZE = 12;\nconst GLB_CHUNK_HEADER_SIZE = 8;\n\nconst GLB_CHUNK_TYPE_JSON = 0x4e4f534a;\nconst GLB_CHUNK_TYPE_BIN = 0x004e4942;\nconst GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED = 0; // DEPRECATED - Backward compatibility for old xviz files\nconst GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED = 1; // DEPRECATED - Backward compatibility for old xviz files\n\nconst GLB_V1_CONTENT_FORMAT_JSON = 0x0;\n\nconst LE = true; // Binary GLTF is little endian.\n\nfunction getMagicString(dataView, byteOffset = 0) {\n return `\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 0))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 1))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 2))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;\n}\n\n// Check if a data view is a GLB\nexport function isGLB(\n arrayBuffer: ArrayBuffer,\n byteOffset: number = 0,\n options: GLBParseOptions = {}\n): boolean {\n const dataView = new DataView(arrayBuffer);\n // Check that GLB Header starts with the magic number\n const {magic = MAGIC_glTF} = options;\n const magic1 = dataView.getUint32(byteOffset, false);\n return magic1 === magic || magic1 === MAGIC_glTF;\n}\n\nexport default function parseGLBSync(\n glb: GLB,\n arrayBuffer: ArrayBuffer,\n byteOffset: number = 0,\n options: GLBParseOptions = {}\n) {\n // Check that GLB Header starts with the magic number\n const dataView = new DataView(arrayBuffer);\n\n // Compare format with GLBLoader documentation\n const type = getMagicString(dataView, byteOffset + 0);\n const version = dataView.getUint32(byteOffset + 4, LE); // Version 2 of binary glTF container format\n const byteLength = dataView.getUint32(byteOffset + 8, LE); // Total byte length of binary file\n\n Object.assign(glb, {\n // Put less important stuff in a header, to avoid clutter\n header: {\n byteOffset, // Byte offset into the initial arrayBuffer\n byteLength,\n hasBinChunk: false\n },\n\n type,\n version,\n\n json: {},\n binChunks: []\n } as GLB);\n\n byteOffset += GLB_FILE_HEADER_SIZE;\n\n switch (glb.version) {\n case 1:\n // eslint-disable-next-line\n return parseGLBV1(glb, dataView, byteOffset);\n case 2:\n // eslint-disable-next-line\n return parseGLBV2(glb, dataView, byteOffset, (options = {}));\n default:\n throw new Error(`Invalid GLB version ${glb.version}. Only supports v1 and v2.`);\n }\n}\n\nfunction parseGLBV1(glb: GLB, dataView: DataView, byteOffset: number): number {\n // Sanity: ensure file is big enough to hold at least the headers\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n\n // Explanation of GLB structure:\n // https://cloud.githubusercontent.com/assets/3479527/22600725/36b87122-ea55-11e6-9d40-6fd42819fcab.png\n const contentLength = dataView.getUint32(byteOffset + 0, LE); // Byte length of chunk\n const contentFormat = dataView.getUint32(byteOffset + 4, LE); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n\n // GLB v1 only supports a single chunk type\n assert(contentFormat === GLB_V1_CONTENT_FORMAT_JSON);\n\n parseJSONChunk(glb, dataView, byteOffset, contentLength);\n // No need to call the function padToBytes() from parseJSONChunk()\n byteOffset += contentLength;\n byteOffset += parseBINChunk(glb, dataView, byteOffset, glb.header.byteLength);\n\n return byteOffset;\n}\n\nfunction parseGLBV2(\n glb: GLB,\n dataView: DataView,\n byteOffset: number,\n options: GLBParseOptions\n): number {\n // Sanity: ensure file is big enough to hold at least the first chunk header\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n\n parseGLBChunksSync(glb, dataView, byteOffset, options);\n\n return byteOffset + glb.header.byteLength;\n}\n\nfunction parseGLBChunksSync(\n glb: GLB,\n dataView: DataView,\n byteOffset: number,\n options: GLBParseOptions\n) {\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n // Iterate as long as there is space left for another chunk header\n while (byteOffset + 8 <= glb.header.byteLength) {\n const chunkLength = dataView.getUint32(byteOffset + 0, LE); // Byte length of chunk\n const chunkFormat = dataView.getUint32(byteOffset + 4, LE); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n switch (chunkFormat) {\n case GLB_CHUNK_TYPE_JSON:\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n break;\n case GLB_CHUNK_TYPE_BIN:\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n break;\n\n // Backward compatibility for very old xviz files\n case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n\n default:\n // Ignore, per spec\n // console.warn(`Unknown GLB chunk type`); // eslint-disable-line\n break;\n }\n\n byteOffset += padToNBytes(chunkLength, 4);\n }\n\n return byteOffset;\n}\n\n// Parse a GLB JSON chunk\nfunction parseJSONChunk(glb: GLB, dataView: DataView, byteOffset: number, chunkLength: number) {\n // 1. Create a \"view\" of the binary encoded JSON data inside the GLB\n const jsonChunk = new Uint8Array(dataView.buffer, byteOffset, chunkLength);\n\n // 2. Decode the JSON binary array into clear text\n const textDecoder = new TextDecoder('utf8');\n const jsonText = textDecoder.decode(jsonChunk);\n\n // 3. Parse the JSON text into a JavaScript data structure\n glb.json = JSON.parse(jsonText);\n\n return padToNBytes(chunkLength, 4);\n}\n\n// Parse a GLB BIN chunk\nfunction parseBINChunk(glb: GLB, dataView, byteOffset, chunkLength) {\n // Note: BIN chunk can be optional\n glb.header.hasBinChunk = true;\n glb.binChunks.push({\n byteOffset,\n byteLength: chunkLength,\n arrayBuffer: dataView.buffer\n // TODO - copy, or create typed array view?\n });\n\n return padToNBytes(chunkLength, 4);\n}\n"],"mappings":"AAIA,SAAQA,WAAW,EAAEC,MAAM,QAAO,0BAA0B;AAO5D,MAAMC,UAAU,GAAG,UAAU;AAE7B,MAAMC,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,qBAAqB,GAAG,CAAC;AAE/B,MAAMC,mBAAmB,GAAG,UAAU;AACtC,MAAMC,kBAAkB,GAAG,UAAU;AACrC,MAAMC,mCAAmC,GAAG,CAAC;AAC7C,MAAMC,kCAAkC,GAAG,CAAC;AAE5C,MAAMC,0BAA0B,GAAG,GAAG;AAEtC,MAAMC,EAAE,GAAG,IAAI;AAEf,SAASC,cAAcA,CAACC,QAAQ,EAAkB;EAAA,IAAhBC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC9C,UAAAG,MAAA,CACAC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CAAC,CAAC,CAAC,EAAAI,MAAA,CACtDC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CAAC,CAAC,CAAC,EAAAI,MAAA,CACtDC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CAAC,CAAC,CAAC,EAAAI,MAAA,CACtDC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QA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AAC+C,WAAW,EAAE,CAAC,CAAC;EAC3C;EAEA,OAAOlC,UAAU;AACnB;AAGA,SAAS+B,cAAcA,CAACf,GAAQ,EAAEjB,QAAkB,EAAEC,UAAkB,EAAEkC,WAAmB,EAAE;EAE7F,MAAMG,SAAS,GAAG,IAAIC,UAAU,CAACvC,QAAQ,CAACwC,MAAM,EAAEvC,UAAU,EAAEkC,WAAW,CAAC;EAG1E,MAAMM,WAAW,GAAG,IAAIC,WAAW,CAAC,MAAM,CAAC;EAC3C,MAAMC,QAAQ,GAAGF,WAAW,CAACG,MAAM,CAACN,SAAS,CAAC;EAG9CrB,GAAG,CAACQ,IAAI,GAAGoB,IAAI,CAACC,KAAK,CAACH,QAAQ,CAAC;EAE/B,OAAOvD,WAAW,CAAC+C,WAAW,EAAE,CAAC,CAAC;AACpC;AAGA,SAASF,aAAaA,CAAChB,GAAQ,EAAEjB,QAAQ,EAAEC,UAAU,EAAEkC,WAAW,EAAE;EAElElB,GAAG,CAACM,MAAM,CAACC,WAAW,GAAG,IAAI;EAC7BP,GAAG,CAACS,SAAS,CAACqB,IAAI,CAAC;IACjB9C,UAAU;IACVmB,UAAU,EAAEe,WAAW;IACvBzB,WAAW,EAAEV,QAAQ,CAACwC;EAExB,CAAC,CAAC;EAEF,OAAOpD,WAAW,CAAC+C,WAAW,EAAE,CAAC,CAAC;AACpC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { BasisLoader, selectSupportedBasisFormat } from '@loaders.gl/textures';
|
|
2
|
+
import { ImageLoader } from '@loaders.gl/images';
|
|
3
|
+
import { parseJSON, sliceArrayBuffer } from '@loaders.gl/loader-utils';
|
|
4
|
+
import { assert } from '../utils/assert';
|
|
5
|
+
import { resolveUrl } from '../gltf-utils/resolve-url';
|
|
6
|
+
import { getTypedArrayForBufferView } from '../gltf-utils/get-typed-array';
|
|
7
|
+
import { preprocessExtensions, decodeExtensions } from '../api/gltf-extensions';
|
|
8
|
+
import { normalizeGLTFV1 } from '../api/normalize-gltf-v1';
|
|
9
|
+
import { postProcessGLTF } from '../api/post-process-gltf';
|
|
10
|
+
import parseGLBSync, { isGLB } from './parse-glb';
|
|
11
|
+
export function isGLTF(arrayBuffer, options) {
|
|
12
|
+
const byteOffset = 0;
|
|
13
|
+
return isGLB(arrayBuffer, byteOffset, options);
|
|
14
|
+
}
|
|
15
|
+
export async function parseGLTF(gltf, arrayBufferOrString) {
|
|
16
|
+
var _options$gltf, _options$gltf2, _options$gltf3, _options$gltf4;
|
|
17
|
+
let byteOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
18
|
+
let options = arguments.length > 3 ? arguments[3] : undefined;
|
|
19
|
+
let context = arguments.length > 4 ? arguments[4] : undefined;
|
|
20
|
+
parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);
|
|
21
|
+
normalizeGLTFV1(gltf, {
|
|
22
|
+
normalize: options === null || options === void 0 ? void 0 : (_options$gltf = options.gltf) === null || _options$gltf === void 0 ? void 0 : _options$gltf.normalize
|
|
23
|
+
});
|
|
24
|
+
preprocessExtensions(gltf, options, context);
|
|
25
|
+
const promises = [];
|
|
26
|
+
if (options !== null && options !== void 0 && (_options$gltf2 = options.gltf) !== null && _options$gltf2 !== void 0 && _options$gltf2.loadBuffers && gltf.json.buffers) {
|
|
27
|
+
await loadBuffers(gltf, options, context);
|
|
28
|
+
}
|
|
29
|
+
if (options !== null && options !== void 0 && (_options$gltf3 = options.gltf) !== null && _options$gltf3 !== void 0 && _options$gltf3.loadImages) {
|
|
30
|
+
const promise = loadImages(gltf, options, context);
|
|
31
|
+
promises.push(promise);
|
|
32
|
+
}
|
|
33
|
+
const promise = decodeExtensions(gltf, options, context);
|
|
34
|
+
promises.push(promise);
|
|
35
|
+
await Promise.all(promises);
|
|
36
|
+
return options !== null && options !== void 0 && (_options$gltf4 = options.gltf) !== null && _options$gltf4 !== void 0 && _options$gltf4.postProcess ? postProcessGLTF(gltf, options) : gltf;
|
|
37
|
+
}
|
|
38
|
+
function parseGLTFContainerSync(gltf, data, byteOffset, options) {
|
|
39
|
+
if (options.uri) {
|
|
40
|
+
gltf.baseUri = options.uri;
|
|
41
|
+
}
|
|
42
|
+
if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options)) {
|
|
43
|
+
const textDecoder = new TextDecoder();
|
|
44
|
+
data = textDecoder.decode(data);
|
|
45
|
+
}
|
|
46
|
+
if (typeof data === 'string') {
|
|
47
|
+
gltf.json = parseJSON(data);
|
|
48
|
+
} else if (data instanceof ArrayBuffer) {
|
|
49
|
+
const glb = {};
|
|
50
|
+
byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);
|
|
51
|
+
assert(glb.type === 'glTF', "Invalid GLB magic string ".concat(glb.type));
|
|
52
|
+
gltf._glb = glb;
|
|
53
|
+
gltf.json = glb.json;
|
|
54
|
+
} else {
|
|
55
|
+
assert(false, 'GLTF: must be ArrayBuffer or string');
|
|
56
|
+
}
|
|
57
|
+
const buffers = gltf.json.buffers || [];
|
|
58
|
+
gltf.buffers = new Array(buffers.length).fill(null);
|
|
59
|
+
if (gltf._glb && gltf._glb.header.hasBinChunk) {
|
|
60
|
+
const {
|
|
61
|
+
binChunks
|
|
62
|
+
} = gltf._glb;
|
|
63
|
+
gltf.buffers[0] = {
|
|
64
|
+
arrayBuffer: binChunks[0].arrayBuffer,
|
|
65
|
+
byteOffset: binChunks[0].byteOffset,
|
|
66
|
+
byteLength: binChunks[0].byteLength
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const images = gltf.json.images || [];
|
|
70
|
+
gltf.images = new Array(images.length).fill({});
|
|
71
|
+
}
|
|
72
|
+
async function loadBuffers(gltf, options, context) {
|
|
73
|
+
const buffers = gltf.json.buffers || [];
|
|
74
|
+
for (let i = 0; i < buffers.length; ++i) {
|
|
75
|
+
const buffer = buffers[i];
|
|
76
|
+
if (buffer.uri) {
|
|
77
|
+
var _context$fetch, _response$arrayBuffer;
|
|
78
|
+
const {
|
|
79
|
+
fetch
|
|
80
|
+
} = context;
|
|
81
|
+
assert(fetch);
|
|
82
|
+
const uri = resolveUrl(buffer.uri, options);
|
|
83
|
+
const response = await (context === null || context === void 0 ? void 0 : (_context$fetch = context.fetch) === null || _context$fetch === void 0 ? void 0 : _context$fetch.call(context, uri));
|
|
84
|
+
const arrayBuffer = await (response === null || response === void 0 ? void 0 : (_response$arrayBuffer = response.arrayBuffer) === null || _response$arrayBuffer === void 0 ? void 0 : _response$arrayBuffer.call(response));
|
|
85
|
+
gltf.buffers[i] = {
|
|
86
|
+
arrayBuffer,
|
|
87
|
+
byteOffset: 0,
|
|
88
|
+
byteLength: arrayBuffer.byteLength
|
|
89
|
+
};
|
|
90
|
+
delete buffer.uri;
|
|
91
|
+
} else if (gltf.buffers[i] === null) {
|
|
92
|
+
gltf.buffers[i] = {
|
|
93
|
+
arrayBuffer: new ArrayBuffer(buffer.byteLength),
|
|
94
|
+
byteOffset: 0,
|
|
95
|
+
byteLength: buffer.byteLength
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function loadImages(gltf, options, context) {
|
|
101
|
+
const imageIndices = getReferencesImageIndices(gltf);
|
|
102
|
+
const images = gltf.json.images || [];
|
|
103
|
+
const promises = [];
|
|
104
|
+
for (const imageIndex of imageIndices) {
|
|
105
|
+
promises.push(loadImage(gltf, images[imageIndex], imageIndex, options, context));
|
|
106
|
+
}
|
|
107
|
+
return await Promise.all(promises);
|
|
108
|
+
}
|
|
109
|
+
function getReferencesImageIndices(gltf) {
|
|
110
|
+
const imageIndices = new Set();
|
|
111
|
+
const textures = gltf.json.textures || [];
|
|
112
|
+
for (const texture of textures) {
|
|
113
|
+
if (texture.source !== undefined) {
|
|
114
|
+
imageIndices.add(texture.source);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return Array.from(imageIndices).sort();
|
|
118
|
+
}
|
|
119
|
+
async function loadImage(gltf, image, index, options, context) {
|
|
120
|
+
const {
|
|
121
|
+
fetch,
|
|
122
|
+
parse
|
|
123
|
+
} = context;
|
|
124
|
+
let arrayBuffer;
|
|
125
|
+
if (image.uri && !image.hasOwnProperty('bufferView')) {
|
|
126
|
+
const uri = resolveUrl(image.uri, options);
|
|
127
|
+
const response = await fetch(uri);
|
|
128
|
+
arrayBuffer = await response.arrayBuffer();
|
|
129
|
+
image.bufferView = {
|
|
130
|
+
data: arrayBuffer
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (Number.isFinite(image.bufferView)) {
|
|
134
|
+
const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);
|
|
135
|
+
arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
|
|
136
|
+
}
|
|
137
|
+
assert(arrayBuffer, 'glTF image has no data');
|
|
138
|
+
let parsedImage = await parse(arrayBuffer, [ImageLoader, BasisLoader], {
|
|
139
|
+
mimeType: image.mimeType,
|
|
140
|
+
basis: options.basis || {
|
|
141
|
+
format: selectSupportedBasisFormat()
|
|
142
|
+
}
|
|
143
|
+
}, context);
|
|
144
|
+
if (parsedImage && parsedImage[0]) {
|
|
145
|
+
parsedImage = {
|
|
146
|
+
compressed: true,
|
|
147
|
+
mipmaps: false,
|
|
148
|
+
width: parsedImage[0].width,
|
|
149
|
+
height: parsedImage[0].height,
|
|
150
|
+
data: parsedImage[0]
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
gltf.images = gltf.images || [];
|
|
154
|
+
gltf.images[index] = parsedImage;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=parse-gltf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-gltf.js","names":["BasisLoader","selectSupportedBasisFormat","ImageLoader","parseJSON","sliceArrayBuffer","assert","resolveUrl","getTypedArrayForBufferView","preprocessExtensions","decodeExtensions","normalizeGLTFV1","postProcessGLTF","parseGLBSync","isGLB","isGLTF","arrayBuffer","options","byteOffset","parseGLTF","gltf","arrayBufferOrString","_options$gltf","_options$gltf2","_options$gltf3","_options$gltf4","arguments","length","undefined","context","parseGLTFContainerSync","normalize","promises","loadBuffers","json","buffers","loadImages","promise","push","Promise","all","postProcess","data","uri","baseUri","ArrayBuffer","textDecoder","TextDecoder","decode","glb","type","concat","_glb","Array","fill","header","hasBinChunk","binChunks","byteLength","images","i","buffer","_context$fetch","_response$arrayBuffer","fetch","response","call","imageIndices","getReferencesImageIndices","imageIndex","loadImage","Set","textures","texture","source","add","from","sort","image","index","parse","hasOwnProperty","bufferView","Number","isFinite","array","parsedImage","mimeType","basis","format","compressed","mipmaps","width","height"],"sources":["../../../../src/lib/parsers/parse-gltf.ts"],"sourcesContent":["/* eslint-disable camelcase, max-statements, no-restricted-globals */\nimport type {LoaderContext} from '@loaders.gl/loader-utils';\nimport {BasisLoader, selectSupportedBasisFormat} from '@loaders.gl/textures';\nimport type {GLTFLoaderOptions} from '../../gltf-loader';\nimport type {GLB} from '../types/glb-types';\nimport type {GLTFWithBuffers} from '../types/gltf-types';\n\nimport {ImageLoader} from '@loaders.gl/images';\nimport {parseJSON, sliceArrayBuffer} from '@loaders.gl/loader-utils';\nimport {assert} from '../utils/assert';\nimport {resolveUrl} from '../gltf-utils/resolve-url';\nimport {getTypedArrayForBufferView} from '../gltf-utils/get-typed-array';\nimport {preprocessExtensions, decodeExtensions} from '../api/gltf-extensions';\nimport {normalizeGLTFV1} from '../api/normalize-gltf-v1';\nimport {postProcessGLTF} from '../api/post-process-gltf';\nimport parseGLBSync, {isGLB} from './parse-glb';\n\nexport type GLTFParseOptions = {\n normalize?: boolean;\n loadImages?: boolean;\n loadBuffers?: boolean;\n decompressMeshes?: boolean;\n postProcess?: boolean;\n excludeExtensions?: string[];\n};\n\n// export type GLTFOptions = {\n// gltf?: GLTFParseOptions;\n// };\n\nexport function isGLTF(arrayBuffer, options?): boolean {\n const byteOffset = 0;\n return isGLB(arrayBuffer, byteOffset, options);\n}\n\nexport async function parseGLTF(\n gltf: GLTFWithBuffers,\n arrayBufferOrString,\n byteOffset = 0,\n options: GLTFLoaderOptions,\n context: LoaderContext\n) {\n parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);\n\n normalizeGLTFV1(gltf, {normalize: options?.gltf?.normalize});\n\n preprocessExtensions(gltf, options, context);\n\n const promises: Promise<any>[] = [];\n\n // Load linked buffers asynchronously and decodes base64 buffers in parallel\n if (options?.gltf?.loadBuffers && gltf.json.buffers) {\n await loadBuffers(gltf, options, context);\n }\n\n if (options?.gltf?.loadImages) {\n const promise = loadImages(gltf, options, context);\n promises.push(promise);\n }\n\n const promise = decodeExtensions(gltf, options, context);\n promises.push(promise);\n\n // Parallelize image loading and buffer loading/extension decoding\n await Promise.all(promises);\n\n // Post processing resolves indices to objects, buffers\n return options?.gltf?.postProcess ? postProcessGLTF(gltf, options) : gltf;\n}\n\n// `data` - can be ArrayBuffer (GLB), ArrayBuffer (Binary JSON), String (JSON), or Object (parsed JSON)\nfunction parseGLTFContainerSync(gltf, data, byteOffset, options) {\n // Initialize gltf container\n if (options.uri) {\n gltf.baseUri = options.uri;\n }\n\n // If data is binary and starting with magic bytes, assume binary JSON text, convert to string\n if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options)) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(data);\n }\n\n if (typeof data === 'string') {\n // If string, try to parse as JSON\n gltf.json = parseJSON(data);\n } else if (data instanceof ArrayBuffer) {\n // If still ArrayBuffer, parse as GLB container\n const glb: GLB = {} as GLB;\n byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);\n\n assert(glb.type === 'glTF', `Invalid GLB magic string ${glb.type}`);\n\n gltf._glb = glb;\n gltf.json = glb.json;\n } else {\n assert(false, 'GLTF: must be ArrayBuffer or string');\n }\n\n // Populate buffers\n // Create an external buffers array to hold binary data\n const buffers = gltf.json.buffers || [];\n gltf.buffers = new Array(buffers.length).fill(null);\n\n // Populates JSON and some bin chunk info\n if (gltf._glb && gltf._glb.header.hasBinChunk) {\n const {binChunks} = gltf._glb;\n gltf.buffers[0] = {\n arrayBuffer: binChunks[0].arrayBuffer,\n byteOffset: binChunks[0].byteOffset,\n byteLength: binChunks[0].byteLength\n };\n\n // TODO - this modifies JSON and is a post processing thing\n // gltf.json.buffers[0].data = gltf.buffers[0].arrayBuffer;\n // gltf.json.buffers[0].byteOffset = gltf.buffers[0].byteOffset;\n }\n\n // Populate images\n const images = gltf.json.images || [];\n gltf.images = new Array(images.length).fill({});\n}\n\n/** Asynchronously fetch and parse buffers, store in buffers array outside of json\n * TODO - traverse gltf and determine which buffers are actually needed\n */\nasync function loadBuffers(gltf: GLTFWithBuffers, options, context: LoaderContext) {\n // TODO\n const buffers = gltf.json.buffers || [];\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = buffers[i];\n if (buffer.uri) {\n const {fetch} = context;\n assert(fetch);\n\n const uri = resolveUrl(buffer.uri, options);\n const response = await context?.fetch?.(uri);\n const arrayBuffer = await response?.arrayBuffer?.();\n\n gltf.buffers[i] = {\n arrayBuffer,\n byteOffset: 0,\n byteLength: arrayBuffer.byteLength\n };\n\n delete buffer.uri;\n } else if (gltf.buffers[i] === null) {\n gltf.buffers[i] = {\n arrayBuffer: new ArrayBuffer(buffer.byteLength),\n byteOffset: 0,\n byteLength: buffer.byteLength\n };\n }\n }\n}\n\n/**\n * Loads all images\n * TODO - traverse gltf and determine which images are actually needed\n * @param gltf\n * @param options\n * @param context\n * @returns\n */\nasync function loadImages(gltf: GLTFWithBuffers, options, context: LoaderContext) {\n const imageIndices = getReferencesImageIndices(gltf);\n\n const images = gltf.json.images || [];\n\n const promises: Promise<any>[] = [];\n for (const imageIndex of imageIndices) {\n promises.push(loadImage(gltf, images[imageIndex], imageIndex, options, context));\n }\n\n return await Promise.all(promises);\n}\n\n/** Make sure we only load images that are actually referenced by textures */\nfunction getReferencesImageIndices(gltf: GLTFWithBuffers): number[] {\n const imageIndices = new Set<number>();\n\n const textures = gltf.json.textures || [];\n for (const texture of textures) {\n if (texture.source !== undefined) {\n imageIndices.add(texture.source);\n }\n }\n\n return Array.from(imageIndices).sort();\n}\n\n/** Asynchronously fetches and parses one image, store in images array outside of json */\nasync function loadImage(\n gltf: GLTFWithBuffers,\n image,\n index: number,\n options,\n context: LoaderContext\n) {\n const {fetch, parse} = context;\n\n let arrayBuffer;\n\n if (image.uri && !image.hasOwnProperty('bufferView')) {\n const uri = resolveUrl(image.uri, options);\n const response = await fetch(uri);\n arrayBuffer = await response.arrayBuffer();\n image.bufferView = {\n data: arrayBuffer\n };\n }\n\n if (Number.isFinite(image.bufferView)) {\n const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);\n arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);\n }\n\n assert(arrayBuffer, 'glTF image has no data');\n\n // Call `parse`\n let parsedImage = await parse(\n arrayBuffer,\n [ImageLoader, BasisLoader],\n {mimeType: image.mimeType, basis: options.basis || {format: selectSupportedBasisFormat()}},\n context\n );\n\n if (parsedImage && parsedImage[0]) {\n parsedImage = {\n compressed: true,\n mipmaps: false,\n width: parsedImage[0].width,\n height: parsedImage[0].height,\n data: parsedImage[0]\n };\n }\n // TODO making sure ImageLoader is overridable by using array of loaders\n // const parsedImage = await parse(arrayBuffer, [ImageLoader]);\n\n // Store the loaded image\n gltf.images = gltf.images || [];\n gltf.images[index] = parsedImage;\n}\n"],"mappings":"AAEA,SAAQA,WAAW,EAAEC,0BAA0B,QAAO,sBAAsB;AAK5E,SAAQC,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,SAAS,EAAEC,gBAAgB,QAAO,0BAA0B;AACpE,SAAQC,MAAM,QAAO,iBAAiB;AACtC,SAAQC,UAAU,QAAO,2BAA2B;AACpD,SAAQC,0BAA0B,QAAO,+BAA+B;AACxE,SAAQC,oBAAoB,EAAEC,gBAAgB,QAAO,wBAAwB;AAC7E,SAAQC,eAAe,QAAO,0BAA0B;AACxD,SAAQC,eAAe,QAAO,0BAA0B;AAC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Content":["export type GLBBinChunk = {\n byteOffset: number;\n byteLength: number;\n arrayBuffer: ArrayBuffer;\n};\n\nexport type GLB = {\n type: string;\n version: number; // Version 2 of binary glTF container format\n\n // Put less important stuff in a header, to avoid clutter\n header: {\n byteOffset: number; // Byte offset into the initial arrayBuffer\n byteLength: number;\n hasBinChunk: boolean;\n };\n\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n json: Record<string, any>;\n binChunks: GLBBinChunk[];\n};\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-json-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-json-schema.ts"],"sourcesContent":["// Types forked from https://github.com/bwasty/gltf-loader-ts under MIT license\n// Generated from official JSON schema using `npm run generate-interface` on 2018-02-24\n\nexport type GLTFId = number;\n\n/**\n * Indices of those attributes that deviate from their initialization value.\n */\nexport interface AccessorSparseIndices {\n /**\n * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.\n */\n bufferView: GLTFId;\n /**\n * The offset relative to the start of the bufferView in bytes. Must be aligned.\n */\n byteOffset?: number;\n /**\n * The indices data type.\n */\n componentType: 5121 | 5123 | 5125 | number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Array of size `accessor.sparse.count` times number of components storing the displaced accessor attributes pointed by `accessor.sparse.indices`.\n */\nexport interface AccessorSparseValues {\n /**\n * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.\n */\n bufferView: GLTFId;\n /**\n * The offset relative to the start of the bufferView in bytes. Must be aligned.\n */\n byteOffset?: number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Sparse storage of attributes that deviate from their initialization value.\n */\nexport interface AccessorSparse {\n /**\n * Number of entries stored in the sparse array.\n */\n count: number;\n /**\n * Index array of size `count` that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase.\n */\n indices: AccessorSparseIndices;\n /**\n * 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.\n */\n values: AccessorSparseValues;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * 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.\n */\nexport interface Accessor {\n /**\n * The index of the bufferView.\n */\n bufferView?: GLTFId;\n /**\n * The offset relative to the start of the bufferView in bytes.\n */\n byteOffset?: number;\n /**\n * The datatype of components in the attribute.\n */\n componentType: 5120 | 5121 | 5122 | 5123 | 5125 | 5126 | number;\n /**\n * Specifies whether integer data values should be normalized.\n */\n normalized?: boolean;\n /**\n * The number of attributes referenced by this accessor.\n */\n count: number;\n /**\n * Specifies if the attribute is a scalar, vector, or matrix.\n */\n type: 'SCALAR' | 'VEC2' | 'VEC3' | 'VEC4' | 'MAT2' | 'MAT3' | 'MAT4' | string;\n /**\n * Maximum value of each component in this attribute.\n */\n max?: number[];\n /**\n * Minimum value of each component in this attribute.\n */\n min?: number[];\n /**\n * Sparse storage of attributes that deviate from their initialization value.\n */\n sparse?: AccessorSparse;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * The index of the node and TRS property that an animation channel targets.\n */\nexport interface AnimationChannelTarget {\n /**\n * The index of the node to target.\n */\n node?: GLTFId;\n /**\n * 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.\n */\n path: 'translation' | 'rotation' | 'scale' | 'weights' | string;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Targets an animation's sampler at a node's property.\n */\nexport interface AnimationChannel {\n /**\n * The index of a sampler in this animation used to compute the value for the target.\n */\n sampler: GLTFId;\n /**\n * The index of the node and TRS property to target.\n */\n target: AnimationChannelTarget;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).\n */\nexport interface AnimationSampler {\n /**\n * The index of an accessor containing keyframe input values, e.g., time.\n */\n input: GLTFId;\n /**\n * Interpolation algorithm.\n */\n interpolation?: 'LINEAR' | 'STEP' | 'CUBICSPLINE' | string;\n /**\n * The index of an accessor, containing keyframe output values.\n */\n output: GLTFId;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A keyframe animation.\n */\nexport interface Animation {\n /**\n * 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.\n */\n channels: AnimationChannel[];\n /**\n * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).\n */\n samplers: AnimationSampler[];\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Metadata about the glTF asset.\n */\nexport interface Asset {\n /**\n * A copyright message suitable for display to credit the content creator.\n */\n copyright?: string;\n /**\n * Tool that generated this glTF model. Useful for debugging.\n */\n generator?: string;\n /**\n * The glTF version that this asset targets.\n */\n version: string;\n /**\n * The minimum glTF version that this asset targets.\n */\n minVersion?: string;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A buffer points to binary geometry, animation, or skins.\n */\nexport interface Buffer {\n /**\n * The uri of the buffer.\n */\n uri?: string;\n /**\n * The length of the buffer in bytes.\n */\n byteLength: number;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A view into a buffer generally representing a subset of the buffer.\n */\nexport interface BufferView {\n /**\n * The index of the buffer.\n */\n buffer: GLTFId;\n /**\n * The offset into the buffer in bytes.\n */\n byteOffset?: number;\n /**\n * The length of the bufferView in bytes.\n */\n byteLength: number;\n /**\n * The stride, in bytes.\n */\n byteStride?: number;\n /**\n * The target that the GPU buffer should be bound to.\n */\n target?: 34962 | 34963 | number;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * An orthographic camera containing properties to create an orthographic projection matrix.\n */\nexport interface CameraOrthographic {\n /**\n * The floating-point horizontal magnification of the view. Must not be zero.\n */\n xmag: number;\n /**\n * The floating-point vertical magnification of the view. Must not be zero.\n */\n ymag: number;\n /**\n * The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`.\n */\n zfar: number;\n /**\n * The floating-point distance to the near clipping plane.\n */\n znear: number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A perspective camera containing properties to create a perspective projection matrix.\n */\nexport interface CameraPerspective {\n /**\n * The floating-point aspect ratio of the field of view.\n */\n aspectRatio?: number;\n /**\n * The floating-point vertical field of view in radians.\n */\n yfov: number;\n /**\n * The floating-point distance to the far clipping plane.\n */\n zfar?: number;\n /**\n * The floating-point distance to the near clipping plane.\n */\n znear: number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene.\n */\nexport interface Camera {\n /**\n * An orthographic camera containing properties to create an orthographic projection matrix.\n */\n orthographic?: CameraOrthographic;\n /**\n * A perspective camera containing properties to create a perspective projection matrix.\n */\n perspective?: CameraPerspective;\n /**\n * Specifies if the camera uses a perspective or orthographic projection.\n */\n type: 'perspective' | 'orthographic' | string;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Image data used to create a texture. Image can be referenced by URI or `bufferView` index. `mimeType` is required in the latter case.\n */\nexport interface Image {\n /**\n * The uri of the image.\n */\n uri?: string;\n /**\n * The image's MIME type.\n */\n mimeType?: 'image/jpeg' | 'image/png' | string;\n /**\n * The index of the bufferView that contains the image. Use this instead of the image's uri property.\n */\n bufferView?: GLTFId;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Reference to a texture.\n */\nexport interface TextureInfo {\n /**\n * The index of the texture.\n */\n index: GLTFId;\n /**\n * The set index of texture's TEXCOORD attribute used for texture coordinate mapping.\n */\n texCoord?: number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.\n */\nexport interface MaterialPbrMetallicRoughness {\n /**\n * The material's base color factor.\n */\n baseColorFactor?: number[];\n /**\n * The base color texture.\n */\n baseColorTexture?: TextureInfo;\n /**\n * The metalness of the material.\n */\n metallicFactor?: number;\n /**\n * The roughness of the material.\n */\n roughnessFactor?: number;\n /**\n * The metallic-roughness texture.\n */\n metallicRoughnessTexture?: TextureInfo;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\nexport interface MaterialNormalTextureInfo {\n index: any;\n texCoord?: any;\n /**\n * The scalar multiplier applied to each normal vector of the normal texture.\n */\n scale?: number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\nexport interface MaterialOcclusionTextureInfo {\n index: any;\n texCoord?: any;\n /**\n * A scalar multiplier controlling the amount of occlusion applied.\n */\n strength?: number;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * The material appearance of a primitive.\n */\nexport interface Material {\n name?: any;\n extensions?: any;\n extras?: any;\n /**\n * 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.\n */\n pbrMetallicRoughness?: MaterialPbrMetallicRoughness;\n /**\n * The normal map texture.\n */\n normalTexture?: MaterialNormalTextureInfo;\n /**\n * The occlusion map texture.\n */\n occlusionTexture?: MaterialOcclusionTextureInfo;\n /**\n * The emissive map texture.\n */\n emissiveTexture?: TextureInfo;\n /**\n * The emissive color of the material.\n */\n emissiveFactor?: number[];\n /**\n * The alpha rendering mode of the material.\n */\n alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND' | string;\n /**\n * The alpha cutoff value of the material.\n */\n alphaCutoff?: number;\n /**\n * Specifies whether the material is double sided.\n */\n doubleSided?: boolean;\n // [k: string]: any;\n}\n\n/**\n * Geometry to be rendered with the given material.\n */\nexport interface MeshPrimitive {\n /**\n * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data.\n */\n attributes: {\n [k: string]: GLTFId;\n };\n /**\n * The index of the accessor that contains the indices.\n */\n indices?: GLTFId;\n /**\n * The index of the material to apply to this primitive when rendering.\n */\n material?: GLTFId;\n /**\n * The type of primitives to render.\n */\n mode?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | number;\n /**\n * An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only `POSITION`, `NORMAL`, and `TANGENT` supported) to their deviations in the Morph Target.\n */\n targets?: {\n [k: string]: GLTFId;\n }[];\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene.\n */\n\nexport interface Mesh {\n id?: string;\n /**\n * An array of primitives, each defining geometry to be rendered with a material.\n */\n primitives: MeshPrimitive[];\n /**\n * Array of weights to be applied to the Morph Targets.\n */\n weights?: number[];\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * 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.\n */\nexport interface Node {\n /**\n * The index of the camera referenced by this node.\n */\n camera?: GLTFId;\n /**\n * The indices of this node's children.\n */\n children?: GLTFId[];\n /**\n * The index of the skin referenced by this node.\n */\n skin?: GLTFId;\n /**\n * A floating-point 4x4 transformation matrix stored in column-major order.\n */\n matrix?: number[];\n /**\n * The index of the mesh in this node.\n */\n mesh?: GLTFId;\n /**\n * The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar.\n */\n rotation?: number[];\n /**\n * The node's non-uniform scale, given as the scaling factors along the x, y, and z axes.\n */\n scale?: number[];\n /**\n * The node's translation along the x, y, and z axes.\n */\n translation?: number[];\n /**\n * The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh.\n */\n weights?: number[];\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Texture sampler properties for filtering and wrapping modes.\n */\nexport interface Sampler {\n /**\n * Magnification filter.\n */\n magFilter?: 9728 | 9729 | number;\n /**\n * Minification filter.\n */\n minFilter?: 9728 | 9729 | 9984 | 9985 | 9986 | 9987 | number;\n /**\n * s wrapping mode.\n */\n wrapS?: 33071 | 33648 | 10497 | number;\n /**\n * t wrapping mode.\n */\n wrapT?: 33071 | 33648 | 10497 | number;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * The root nodes of a scene.\n */\nexport interface Scene {\n /**\n * The indices of each root node.\n */\n nodes?: GLTFId[];\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * Joints and matrices defining a skin.\n */\nexport interface Skin {\n /**\n * 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.\n */\n inverseBindMatrices?: GLTFId;\n /**\n * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root.\n */\n skeleton?: GLTFId;\n /**\n * Indices of skeleton nodes, used as joints in this skin.\n */\n joints: GLTFId[];\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * A texture and its sampler.\n */\nexport interface Texture {\n /**\n * The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used.\n */\n sampler?: GLTFId;\n /**\n * The index of the image used by this texture.\n */\n source?: GLTFId;\n name?: any;\n extensions?: any;\n extras?: any;\n // [k: string]: any;\n}\n\n/**\n * The root object for a glTF asset.\n */\nexport interface GLTF {\n /**\n * Names of glTF extensions used somewhere in this asset.\n */\n extensionsUsed?: string[];\n /**\n * Names of glTF extensions required to properly load this asset.\n */\n extensionsRequired?: string[];\n /**\n * An array of accessors.\n */\n accessors?: Accessor[];\n /**\n * An array of keyframe animations.\n */\n animations?: Animation[];\n /**\n * Metadata about the glTF asset.\n */\n asset: Asset;\n /**\n * An array of buffers.\n */\n buffers?: Buffer[];\n /**\n * An array of bufferViews.\n */\n bufferViews?: BufferView[];\n /**\n * An array of cameras.\n */\n cameras?: Camera[];\n /**\n * An array of images.\n */\n images?: Image[];\n /**\n * An array of materials.\n */\n materials?: Material[];\n /**\n * An array of meshes.\n */\n meshes?: Mesh[];\n /**\n * An array of nodes.\n */\n nodes?: Node[];\n /**\n * An array of samplers.\n */\n samplers?: Sampler[];\n /**\n * The index of the default scene.\n */\n scene?: GLTFId;\n /**\n * An array of scenes.\n */\n scenes?: Scene[];\n /**\n * An array of skins.\n */\n skins?: Skin[];\n /**\n * An array of textures.\n */\n textures?: Texture[];\n extensions?: unknown;\n extras?: unknown;\n [k: string]: unknown;\n}\n\n// GLTF Extensions\n/* eslint-disable camelcase */\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\n * TODO - this can be used on both images and shaders\n */\nexport type GLTF_KHR_binary_glTF = {\n bufferView: number;\n // required for images but not shaders\n mimeType?: string;\n height?: number;\n width?: number;\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n */\nexport type GLTF_KHR_draco_mesh_compression = {\n bufferView: GLTFId;\n attributes: {[name: string]: number};\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu\n */\nexport type GLTF_KHR_texture_basisu = {\n source: GLTFId;\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression\n * buffer: number; //\tThe index of the buffer with compressed data.\t✅ Required\n * byteOffset\tinteger\tThe offset into the buffer in bytes.\tDefault: 0\n * byteLength\tinteger\tThe length of the compressed data in bytes.\t✅ Required\n * byteStride\tinteger\tThe stride, in bytes.\t✅ Required\n * count\tinteger\tThe number of elements.\t✅ Required\n * mode\tstring\tThe compression mode.\t✅ Required\n * filter\tstring\tThe compression filter.\tDefault: \"NONE\"\n */\nexport type GLTF_EXT_meshopt_compression = {\n buffer: number;\n byteOffset?: number;\n byteLength: number;\n byteStride: number;\n count: number;\n mode: 'ATTRIBUTES' | 'TRIANGLES' | 'INDICES';\n filter?: 'NONE' | 'OCTAHEDRAL' | 'QUATERNION' | 'EXPONENTIAL';\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp\n */\nexport type GLTF_EXT_texture_webp = {\n source: GLTFId;\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds\n */\nexport type GLTF_MSFT_texture_dds = {\n source: GLTFId;\n extras?: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#gltf-extension-1\n */\nexport type GLTF_EXT_feature_metadata = {\n /** An object defining classes and enums. */\n schema?: ExtFeatureMetadataSchema;\n /** A uri to an external schema file. */\n schemaUri?: string;\n /** An object containing statistics about features. */\n statistics?: Statistics;\n /** A dictionary, where each key is a feature table ID and each value is an object defining the feature table. */\n featureTables?: {\n [key: string]: EXT_feature_metadata_feature_table;\n };\n /** A dictionary, where each key is a feature texture ID and each value is an object defining the feature texture. */\n featureTextures?: {\n [key: string]: FeatureTexture;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#schema\n */\ntype ExtFeatureMetadataSchema = {\n /** The name of the schema. */\n name?: string;\n /** The description of the schema. */\n description?: string;\n /** Application-specific version of the schema. */\n version?: string;\n /** A dictionary, where each key is a class ID and each value is an object defining the class. */\n classes?: {\n [key: string]: EXT_feature_metadata_class_object;\n };\n /** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */\n enums?: {\n [key: string]: ExtFeatureMetadataEnum;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class\n */\nexport type EXT_feature_metadata_class_object = {\n /** The name of the class, e.g. for display purposes. */\n name?: string;\n /** The description of the class. */\n description?: string;\n /** A dictionary, where each key is a property ID and each value is an object defining the property. */\n properties: {\n [key: string]: ClassProperty;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class-property\n */\nexport type ClassProperty = {\n /** The name of the property, e.g. for display purposes. */\n name?: string;\n /** The description of the property. */\n description?: string;\n /**\n * The property type. If ENUM is used, then enumType must also be specified.\n * If ARRAY is used, then componentType must also be specified.\n * ARRAY is a fixed-length array when componentCount is defined, and variable-length otherwise.\n */\n type: ClassPropertyType;\n /**\n * An enum ID as declared in the enums dictionary.\n * This value must be specified when type or componentType is ENUM.\n */\n enumType?: string;\n /**\n * When type is ARRAY this indicates the type of each component of the array.\n * If ENUM is used, then enumType must also be specified.\n */\n componentType?:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM';\n /** The number of components per element for ARRAY elements. */\n componentCount?: number;\n /**\n * Specifies whether integer values are normalized.\n * This applies both when type is an integer type, or when type is ARRAY with a componentType that is an integer type.\n * For unsigned integer types, values are normalized between [0.0, 1.0].\n * For signed integer types, values are normalized between [-1.0, 1.0].\n * For all other types, this property is ignored.\n */\n normalized: boolean;\n /**\n * Maximum allowed values for property values.\n * Only applicable for numeric types and fixed-length arrays of numeric types.\n * For numeric types this is a single number.\n * For fixed-length arrays this is an array with componentCount number of elements.\n * The normalized property has no effect on these values: they always correspond to the integer values.\n */\n max?: number | number[];\n /**\n * Minimum allowed values for property values.\n * Only applicable for numeric types and fixed-length arrays of numeric types.\n * For numeric types this is a single number.\n * For fixed-length arrays this is an array with componentCount number of elements.\n * The normalized property has no effect on these values: they always correspond to the integer values.\n */\n min?: number | number[];\n\n /**\n * A default value to use when the property value is not defined.\n * If used, optional must be set to true.\n * The type of the default value must match the property definition: For BOOLEAN use true or false.\n * For STRING use a JSON string. For a numeric type use a JSON number.\n * For ENUM use the enum name, not the integer value.\n * For ARRAY use a JSON array containing values matching the componentType.\n */\n default?: boolean | number | string | number[];\n /** If true, this property is optional. */\n optional?: boolean; // default false;\n /**\n * An identifier that describes how this property should be interpreted.\n * The semantic cannot be used by other properties in the class.\n */\n semantic?: string;\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#classpropertytype\n */\ntype ClassPropertyType =\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM'\n | 'ARRAY';\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#enum\n */\ntype ExtFeatureMetadataEnum = {\n /** The name of the enum, e.g. for display purposes. */\n name?: string;\n /** The description of the enum. */\n description?: string;\n /** The type of the integer enum value. */\n valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64'; // default: \"UINT16\"\n /** An array of enum values. Duplicate names or duplicate integer values are not allowed. */\n values: EnumValue[];\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#enum-value\n */\ntype EnumValue = {\n /** The name of the enum value. */\n name: string;\n /** The description of the enum value. */\n description?: string;\n /** The integer enum value. */\n value: number; // default: \"UINT16\"\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-table\n */\nexport type EXT_feature_metadata_feature_table = {\n featureTable: any;\n /** The class that property values conform to. The value must be a class ID declared in the classes dictionary. */\n class?: string;\n /** The number of features, as well as the number of elements in each property array. */\n count: number;\n /**\n * A dictionary, where each key corresponds to a property ID in the class properties dictionary\n * and each value is an object describing where property values are stored.\n * Optional properties may be excluded from this dictionary.\n */\n properties?: {\n [key: string]: FeatureTableProperty;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-table-property\n */\nexport type FeatureTableProperty = {\n /**\n * The index of the buffer view containing property values.\n * The data type of property values is determined by the property definition:\n * When type is BOOLEAN values are packed into a bitfield.\n * When type is STRING values are stored as byte sequences and decoded as UTF-8 strings.\n * When type is a numeric type values are stored as the provided type.\n * When type is ENUM values are stored as the enum's valueType.\n * Each enum value in the buffer must match one of the allowed values in the enum definition.\n * When type is ARRAY elements are packed tightly together and the data type is based on the componentType following the same rules as above.\n * arrayOffsetBufferView is required for variable-size arrays\n * and stringOffsetBufferView is required for strings (for variable-length arrays of strings, both are required)\n * The buffer view byteOffset must be aligned to a multiple of 8 bytes.\n * If the buffer view's buffer is the GLB-stored BIN chunk the byte offset is measured relative to the beginning of the GLB.\n * Otherwise it is measured relative to the beginning of the buffer.\n */\n bufferView: number;\n /** The type of values in arrayOffsetBufferView and stringOffsetBufferView. */\n offsetType?: string; // default: \"UINT32\"\n /**\n * The index of the buffer view containing offsets for variable-length arrays.\n * The number of offsets is equal to the feature table count plus one.\n * The offsets represent the start positions of each array, with the last offset representing the position after the last array.\n * The array length is computed using the difference between the current offset and the subsequent offset.\n * If componentType is STRING the offsets index into the string offsets array (stored in stringOffsetBufferView),\n * otherwise they index into the property array (stored in bufferView).\n * The data type of these offsets is determined by offsetType.\n * The buffer view byteOffset must be aligned to a multiple of 8 bytes in the same manner as the main bufferView\n */\n arrayOffsetBufferView?: number;\n /**\n * The index of the buffer view containing offsets for strings.\n * The number of offsets is equal to the number of string components plus one.\n * The offsets represent the byte offsets of each string in the main bufferView,\n * with the last offset representing the byte offset after the last string.\n * The string byte length is computed using the difference between the current offset and the subsequent offset.\n * The data type of these offsets is determined by offsetType.\n * The buffer view byteOffset must be aligned to a multiple of 8 bytes in the same manner as the main bufferView.\n */\n stringOffsetBufferView?: number;\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-texture\n */\ntype FeatureTexture = {\n /** The class this feature texture conforms to. The value must be a class ID declared in the classes dictionary. */\n class: string;\n /**\n * A dictionary, where each key corresponds to a property ID in the class properties dictionary\n * and each value describes the texture channels containing property values.\n */\n properties: {\n [key: string]: TextureAccessor;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#texture-accessor\n */\ntype TextureAccessor = {\n /** Texture channels containing property values. Channels are labeled by rgba and are swizzled with a string of 1-4 characters. */\n channels: string;\n /** The glTF texture and texture coordinates to use. */\n texture: TextureInfo;\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#statistics-1\n */\ntype Statistics = {\n /**\n * A dictionary, where each key is a class ID declared in the classes dictionary\n * and each value is an object containing statistics about features that conform to the class.\n */\n classes?: {\n [key: string]: ClassStatistics;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class-statistics\n */\ntype ClassStatistics = {\n /** The number of features that conform to the class. */\n count?: number;\n /**\n * A dictionary, where each key is a class ID declared in the classes dictionary\n * and each value is an object containing statistics about property values.\n */\n properties?: {\n [key: string]: StatisticsClassProperty;\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#property-statistics\n * min, max, mean, median, standardDeviation, variance, sum are\n * only applicable for numeric types and fixed-length arrays of numeric types.\n * For numeric types this is a single number.\n * For fixed-length arrays this is an array with componentCount number of elements.\n * The normalized property has no effect on these values.\n */\ntype StatisticsClassProperty = {\n /** The minimum property value. */\n min?: number | number[];\n /** The maximum property value. */\n max?: number | number[];\n /** The arithmetic mean of the property values. */\n mean?: number | number[];\n /** The median of the property values. */\n median?: number | number[];\n /** The standard deviation of the property values. */\n standardDeviation?: number | number[];\n /** The variance of the property values. */\n variance?: number | number[];\n /** The sum of the property values. */\n sum?: number | number[];\n /**\n * A dictionary, where each key corresponds to an enum name and each value is the number of occurrences of that enum.\n * Only applicable when type or componentType is ENUM.\n * For fixed-length arrays, this is an array with componentCount number of elements.\n */\n occurrences: {\n [key: string]: number | number[];\n };\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * 3DTilesNext EXT_feature_metadata primitive extension\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#primitive-extension\n */\nexport type GLTF_EXT_feature_metadata_primitive = {\n /** Feature ids definition in attributes */\n featureIdAttributes?: GLTF_EXT_feature_metadata_attribute[];\n /** Feature ids definition in textures */\n featureIdTextures?: GLTF_EXT_feature_metadata_attribute[];\n /** An array of IDs of feature textures from the root EXT_feature_metadata object. */\n featureTextures?: string[];\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Attribute which described featureIds definition.\n */\nexport type GLTF_EXT_feature_metadata_attribute = {\n /** Name of feature table */\n featureTable: string;\n /** Described how feature ids are defined */\n featureIds: ExtFeatureMetadataFeatureIds;\n extensions?: any;\n extras?: any;\n [key: string]: any;\n};\n\n/**\n * Defining featureIds by attributes or implicitly.\n */\ntype ExtFeatureMetadataFeatureIds = {\n /** Name of attribute where featureIds are defined */\n attribute?: string;\n /** Sets a constant feature ID for each vertex. The default is 0. */\n constant?: number;\n /** Sets the rate at which feature IDs increment.\n * If divisor is zero then constant is used.\n * If divisor is greater than zero the feature ID increments once per divisor sets of vertices, starting at constant.\n * The default is 0\n */\n divisor?: number;\n /** gLTF textureInfo object - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/specification/2.0/schema/textureInfo.schema.json */\n texture?: ExtFeatureMetadataTexture;\n /** Must be a single channel (\"r\", \"g\", \"b\", or \"a\") */\n channels?: 'r' | 'g' | 'b' | 'a';\n};\n\n/**\n * Reference to a texture.\n */\ntype ExtFeatureMetadataTexture = {\n /** The set index of texture's TEXCOORD attribute used for texture coordinate mapping.*/\n texCoord: number;\n /** The index of the texture. */\n index: number;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-postprocessed-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-postprocessed-schema.ts"],"sourcesContent":["// Types forked from https://github.com/bwasty/gltf-loader-ts under MIT license\n// Generated from official JSON schema using `npm run generate-interface` on 2018-02-24\n\n// tslint:disable:quotemark\n// tslint:disable:max-line-length\n\nexport type GlTfId = number;\n/**\n * Indices of those attributes that deviate from their initialization value.\n */\nexport interface AccessorSparseIndices {\n /**\n * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.\n */\n bufferView: GlTfId;\n /**\n * The offset relative to the start of the bufferView in bytes. Must be aligned.\n */\n byteOffset?: number;\n /**\n * The indices data type.\n */\n componentType: 5121 | 5123 | 5125 | number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Array of size `accessor.sparse.count` times number of components storing the displaced accessor attributes pointed by `accessor.sparse.indices`.\n */\nexport interface AccessorSparseValues {\n /**\n * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.\n */\n bufferView: GlTfId;\n /**\n * The offset relative to the start of the bufferView in bytes. Must be aligned.\n */\n byteOffset?: number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Sparse storage of attributes that deviate from their initialization value.\n */\nexport interface AccessorSparse {\n /**\n * Number of entries stored in the sparse array.\n */\n count: number;\n /**\n * Index array of size `count` that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase.\n */\n indices: AccessorSparseIndices;\n /**\n * 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.\n */\n values: AccessorSparseValues;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * 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.\n */\nexport interface Accessor {\n /**\n * The index of the bufferView.\n */\n bufferView?: GlTfId;\n /**\n * The offset relative to the start of the bufferView in bytes.\n */\n byteOffset?: number;\n /**\n * The datatype of components in the attribute.\n */\n componentType: 5120 | 5121 | 5122 | 5123 | 5125 | 5126 | number;\n /**\n * Specifies whether integer data values should be normalized.\n */\n normalized?: boolean;\n /**\n * The number of attributes referenced by this accessor.\n */\n count: number;\n /**\n * Specifies if the attribute is a scalar, vector, or matrix.\n */\n type: 'SCALAR' | 'VEC2' | 'VEC3' | 'VEC4' | 'MAT2' | 'MAT3' | 'MAT4' | string;\n /**\n * Maximum value of each component in this attribute.\n */\n max?: number[];\n /**\n * Minimum value of each component in this attribute.\n */\n min?: number[];\n /**\n * Sparse storage of attributes that deviate from their initialization value.\n */\n sparse?: AccessorSparse;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * The index of the node and TRS property that an animation channel targets.\n */\nexport interface AnimationChannelTarget {\n /**\n * The index of the node to target.\n */\n node?: GlTfId;\n /**\n * 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.\n */\n path: 'translation' | 'rotation' | 'scale' | 'weights' | string;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Targets an animation's sampler at a node's property.\n */\nexport interface AnimationChannel {\n /**\n * The index of a sampler in this animation used to compute the value for the target.\n */\n sampler: GlTfId;\n /**\n * The index of the node and TRS property to target.\n */\n target: AnimationChannelTarget;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).\n */\nexport interface AnimationSampler {\n /**\n * The index of an accessor containing keyframe input values, e.g., time.\n */\n input: GlTfId;\n /**\n * Interpolation algorithm.\n */\n interpolation?: 'LINEAR' | 'STEP' | 'CUBICSPLINE' | string;\n /**\n * The index of an accessor, containing keyframe output values.\n */\n output: GlTfId;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A keyframe animation.\n */\nexport interface Animation {\n /**\n * 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.\n */\n channels: AnimationChannel[];\n /**\n * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).\n */\n samplers: AnimationSampler[];\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Metadata about the glTF asset.\n */\nexport interface Asset {\n /**\n * A copyright message suitable for display to credit the content creator.\n */\n copyright?: string;\n /**\n * Tool that generated this glTF model. Useful for debugging.\n */\n generator?: string;\n /**\n * The glTF version that this asset targets.\n */\n version: string;\n /**\n * The minimum glTF version that this asset targets.\n */\n minVersion?: string;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A buffer points to binary geometry, animation, or skins.\n */\nexport interface Buffer {\n /**\n * The uri of the buffer.\n */\n uri?: string;\n /**\n * The length of the buffer in bytes.\n */\n byteLength: number;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A view into a buffer generally representing a subset of the buffer.\n */\nexport interface BufferView {\n id: string;\n /**\n * The index of the buffer.\n */\n buffer: ArrayBuffer;\n /**\n * The offset into the buffer in bytes.\n */\n byteOffset?: number;\n /**\n * The length of the bufferView in bytes.\n */\n byteLength: number;\n /**\n * The stride, in bytes.\n */\n byteStride?: number;\n /**\n * The target that the GPU buffer should be bound to.\n */\n target?: 34962 | 34963 | number;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * An orthographic camera containing properties to create an orthographic projection matrix.\n */\nexport interface CameraOrthographic {\n /**\n * The floating-point horizontal magnification of the view. Must not be zero.\n */\n xmag: number;\n /**\n * The floating-point vertical magnification of the view. Must not be zero.\n */\n ymag: number;\n /**\n * The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`.\n */\n zfar: number;\n /**\n * The floating-point distance to the near clipping plane.\n */\n znear: number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A perspective camera containing properties to create a perspective projection matrix.\n */\nexport interface CameraPerspective {\n /**\n * The floating-point aspect ratio of the field of view.\n */\n aspectRatio?: number;\n /**\n * The floating-point vertical field of view in radians.\n */\n yfov: number;\n /**\n * The floating-point distance to the far clipping plane.\n */\n zfar?: number;\n /**\n * The floating-point distance to the near clipping plane.\n */\n znear: number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene.\n */\nexport interface Camera {\n /**\n * An orthographic camera containing properties to create an orthographic projection matrix.\n */\n orthographic?: CameraOrthographic;\n /**\n * A perspective camera containing properties to create a perspective projection matrix.\n */\n perspective?: CameraPerspective;\n /**\n * Specifies if the camera uses a perspective or orthographic projection.\n */\n type: 'perspective' | 'orthographic' | string;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Image data used to create a texture. Image can be referenced by URI or `bufferView` index. `mimeType` is required in the latter case.\n */\nexport interface Image {\n /**\n * The uri of the image.\n */\n uri?: string;\n /**\n * The image's MIME type.\n */\n mimeType?: 'image/jpeg' | 'image/png' | string;\n /**\n * The index of the bufferView that contains the image. Use this instead of the image's uri property.\n */\n bufferView?: BufferView;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Reference to a texture.\n */\nexport interface TextureInfo {\n /**\n * The index of the texture.\n */\n index: GlTfId;\n /**\n * The set index of texture's TEXCOORD attribute used for texture coordinate mapping.\n */\n texCoord?: number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.\n */\nexport interface MaterialPbrMetallicRoughness {\n /**\n * The material's base color factor.\n */\n baseColorFactor?: number[];\n /**\n * The base color texture.\n */\n baseColorTexture?: TextureInfo;\n /**\n * The metalness of the material.\n */\n metallicFactor?: number;\n /**\n * The roughness of the material.\n */\n roughnessFactor?: number;\n /**\n * The metallic-roughness texture.\n */\n metallicRoughnessTexture?: TextureInfo;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\nexport interface MaterialNormalTextureInfo {\n index?: any;\n texCoord?: any;\n /**\n * The scalar multiplier applied to each normal vector of the normal texture.\n */\n scale?: number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\nexport interface MaterialOcclusionTextureInfo {\n index?: any;\n texCoord?: any;\n /**\n * A scalar multiplier controlling the amount of occlusion applied.\n */\n strength?: number;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * The material appearance of a primitive.\n */\nexport interface Material {\n name?: any;\n extensions?: any;\n extras?: any;\n /**\n * 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.\n */\n pbrMetallicRoughness?: MaterialPbrMetallicRoughness;\n /**\n * The normal map texture.\n */\n normalTexture?: MaterialNormalTextureInfo;\n /**\n * The occlusion map texture.\n */\n occlusionTexture?: MaterialOcclusionTextureInfo;\n /**\n * The emissive map texture.\n */\n emissiveTexture?: TextureInfo;\n /**\n * The emissive color of the material.\n */\n emissiveFactor?: number[];\n /**\n * The alpha rendering mode of the material.\n */\n alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND' | string;\n /**\n * The alpha cutoff value of the material.\n */\n alphaCutoff?: number;\n /**\n * Specifies whether the material is double sided.\n */\n doubleSided?: boolean;\n [k: string]: any;\n}\n/**\n * Geometry to be rendered with the given material.\n */\nexport interface MeshPrimitive {\n /**\n * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data.\n */\n attributes: {\n [k: string]: Accessor;\n };\n /**\n * The index of the accessor that contains the indices.\n */\n indices?: Accessor;\n /**\n * The index of the material to apply to this primitive when rendering.\n */\n material?: Material;\n /**\n * The type of primitives to render.\n */\n mode?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | number;\n /**\n * An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only `POSITION`, `NORMAL`, and `TANGENT` supported) to their deviations in the Morph Target.\n */\n targets?: {\n [k: string]: GlTfId;\n }[];\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene.\n */\nexport interface Mesh {\n /**\n * An array of primitives, each defining geometry to be rendered with a material.\n */\n primitives: MeshPrimitive[];\n /**\n * Array of weights to be applied to the Morph Targets.\n */\n weights?: number[];\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * 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.\n */\nexport interface Node {\n /**\n * The index of the camera referenced by this node.\n */\n camera?: GlTfId;\n /**\n * The indices of this node's children.\n */\n children?: Node[];\n /**\n * The index of the skin referenced by this node.\n */\n skin?: GlTfId;\n /**\n * A floating-point 4x4 transformation matrix stored in column-major order.\n */\n matrix?: number[];\n /**\n * The index of the mesh in this node.\n */\n mesh?: Mesh;\n /**\n * The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar.\n */\n rotation?: number[];\n /**\n * The node's non-uniform scale, given as the scaling factors along the x, y, and z axes.\n */\n scale?: number[];\n /**\n * The node's translation along the x, y, and z axes.\n */\n translation?: number[];\n /**\n * The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh.\n */\n weights?: number[];\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Texture sampler properties for filtering and wrapping modes.\n */\nexport interface Sampler {\n /**\n * Magnification filter.\n */\n magFilter?: 9728 | 9729 | number;\n /**\n * Minification filter.\n */\n minFilter?: 9728 | 9729 | 9984 | 9985 | 9986 | 9987 | number;\n /**\n * s wrapping mode.\n */\n wrapS?: 33071 | 33648 | 10497 | number;\n /**\n * t wrapping mode.\n */\n wrapT?: 33071 | 33648 | 10497 | number;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * The root nodes of a scene.\n */\nexport interface Scene {\n /**\n * The indices of each root node.\n */\n nodes?: Node[];\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * Joints and matrices defining a skin.\n */\nexport interface Skin {\n /**\n * 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.\n */\n inverseBindMatrices?: GlTfId;\n /**\n * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root.\n */\n skeleton?: GlTfId;\n /**\n * Indices of skeleton nodes, used as joints in this skin.\n */\n joints: GlTfId[];\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * A texture and its sampler.\n */\nexport interface Texture {\n /**\n * The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used.\n */\n sampler?: GlTfId;\n /**\n * The index of the image used by this texture.\n */\n source?: Image;\n name?: any;\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n/**\n * The root object for a glTF asset.\n */\nexport interface GLTF {\n /**\n * Names of glTF extensions used somewhere in this asset.\n */\n extensionsUsed?: string[];\n /**\n * Names of glTF extensions required to properly load this asset.\n */\n extensionsRequired?: string[];\n /**\n * An array of accessors.\n */\n accessors?: Accessor[];\n /**\n * An array of keyframe animations.\n */\n animations?: Animation[];\n /**\n * Metadata about the glTF asset.\n */\n asset: Asset;\n /**\n * An array of buffers.\n */\n buffers?: Buffer[];\n /**\n * An array of bufferViews.\n */\n bufferViews?: BufferView[];\n /**\n * An array of cameras.\n */\n cameras?: Camera[];\n /**\n * An array of images.\n */\n images?: Image[];\n /**\n * An array of materials.\n */\n materials?: Material[];\n /**\n * An array of meshes.\n */\n meshes?: Mesh[];\n /**\n * An array of nodes.\n */\n nodes?: Node[];\n /**\n * An array of samplers.\n */\n samplers?: Sampler[];\n /**\n * The index of the default scene.\n */\n scene?: Scene;\n /**\n * An array of scenes.\n */\n scenes?: Scene[];\n /**\n * An array of skins.\n */\n skins?: Skin[];\n /**\n * An array of textures.\n */\n textures?: Texture[];\n extensions?: any;\n extras?: any;\n [k: string]: any;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-types.js","names":[],"sources":["../../../../src/lib/types/gltf-types.ts"],"sourcesContent":["/* eslint-disable camelcase */\n\n// Export renamed auto generated types\nimport type {\n GLTF,\n Accessor as GLTFAccessor,\n Buffer as GLTFBuffer,\n BufferView as GLTFBufferView,\n MeshPrimitive as GLTFMeshPrimitive,\n Mesh as GLTFMesh,\n Node as GLTFNode,\n Material as GLTFMaterial,\n Sampler as GLTFSampler,\n Scene as GLTFScene,\n Skin as GLTFSkin,\n Texture as GLTFTexture,\n Image as GLTFImage,\n GLTF_KHR_binary_glTF,\n GLTF_KHR_draco_mesh_compression,\n GLTF_KHR_texture_basisu,\n GLTF_EXT_meshopt_compression,\n GLTF_EXT_texture_webp,\n GLTF_EXT_feature_metadata\n} from './gltf-json-schema';\n\nimport type {\n GLTF as GLTFPostprocessed,\n Accessor as GLTFAccessorPostprocessed,\n Image as GLTFImagePostprocessed,\n Mesh as GLTFMeshPostprocessed,\n MeshPrimitive as GLTFMeshPrimitivePostprocessed,\n Material as GLTFMaterialPostprocessed,\n Node as GLTFNodePostprocessed,\n Texture as GLTFTexturePostprocessed\n} from './gltf-postprocessed-schema';\n\nexport type {\n GLTF,\n GLTFAccessor,\n GLTFBuffer,\n GLTFBufferView,\n GLTFMeshPrimitive,\n GLTFMesh,\n GLTFNode,\n GLTFMaterial,\n GLTFSampler,\n GLTFScene,\n GLTFSkin,\n GLTFTexture,\n GLTFImage,\n GLTF_KHR_binary_glTF,\n GLTF_KHR_draco_mesh_compression,\n GLTF_KHR_texture_basisu,\n GLTF_EXT_meshopt_compression,\n GLTF_EXT_texture_webp,\n GLTFPostprocessed,\n GLTFAccessorPostprocessed,\n GLTFImagePostprocessed,\n GLTFNodePostprocessed,\n GLTFMeshPostprocessed,\n GLTFMeshPrimitivePostprocessed,\n GLTFMaterialPostprocessed,\n GLTFTexturePostprocessed,\n GLTF_EXT_feature_metadata\n};\n\nexport type GLTFObject =\n | GLTFAccessor\n | GLTFBuffer\n | GLTFBufferView\n | GLTFMeshPrimitive\n | GLTFMesh\n | GLTFNode\n | GLTFMaterial\n | GLTFSampler\n | GLTFScene\n | GLTFSkin\n | GLTFTexture\n | GLTFImage;\n\n/** GLTFLoader removes processed extensions from `extensionsUsed` and `extensionsUsed`\n * `processedExtensions` is used to track those extensions\n */\nexport type GLTFWithBuffers = {\n json: GLTF;\n buffers: any[];\n binary?: ArrayBuffer;\n images?: any[];\n};\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../../src/lib/utils/assert.ts"],"sourcesContent":["// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport function assert(condition: unknown, message?: string): void {\n if (!condition) {\n throw new Error(message || 'assert failed: gltf');\n }\n}\n"],"mappings":"AAGA,OAAO,SAASA,MAAMA,CAACC,SAAkB,EAAEC,OAAgB,EAAQ;EACjE,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,qBAAqB,CAAC;EACnD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","names":["VERSION"],"sources":["../../../../src/lib/utils/version.ts"],"sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"mappings":"AAGA,OAAO,MAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const isWebAssemblySupported = typeof WebAssembly !== 'object';
|
|
2
|
+
const wasm_base = 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYA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GlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';
|
|
4
|
+
const detector = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]);
|
|
5
|
+
const wasmpack = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]);
|
|
6
|
+
const FILTERS = {
|
|
7
|
+
0: '',
|
|
8
|
+
1: 'meshopt_decodeFilterOct',
|
|
9
|
+
2: 'meshopt_decodeFilterQuat',
|
|
10
|
+
3: 'meshopt_decodeFilterExp',
|
|
11
|
+
NONE: '',
|
|
12
|
+
OCTAHEDRAL: 'meshopt_decodeFilterOct',
|
|
13
|
+
QUATERNION: 'meshopt_decodeFilterQuat',
|
|
14
|
+
EXPONENTIAL: 'meshopt_decodeFilterExp'
|
|
15
|
+
};
|
|
16
|
+
const DECODERS = {
|
|
17
|
+
0: 'meshopt_decodeVertexBuffer',
|
|
18
|
+
1: 'meshopt_decodeIndexBuffer',
|
|
19
|
+
2: 'meshopt_decodeIndexSequence',
|
|
20
|
+
ATTRIBUTES: 'meshopt_decodeVertexBuffer',
|
|
21
|
+
TRIANGLES: 'meshopt_decodeIndexBuffer',
|
|
22
|
+
INDICES: 'meshopt_decodeIndexSequence'
|
|
23
|
+
};
|
|
24
|
+
export function isMeshoptSupported() {
|
|
25
|
+
return isWebAssemblySupported;
|
|
26
|
+
}
|
|
27
|
+
export async function meshoptDecodeVertexBuffer(target, count, size, source) {
|
|
28
|
+
let filter = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'NONE';
|
|
29
|
+
const instance = await loadWasmInstance();
|
|
30
|
+
decode(instance, instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[FILTERS[filter]]);
|
|
31
|
+
}
|
|
32
|
+
export async function meshoptDecodeIndexBuffer(target, count, size, source) {
|
|
33
|
+
const instance = await loadWasmInstance();
|
|
34
|
+
decode(instance, instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);
|
|
35
|
+
}
|
|
36
|
+
export async function meshoptDecodeIndexSequence(target, count, size, source) {
|
|
37
|
+
const instance = await loadWasmInstance();
|
|
38
|
+
decode(instance, instance.exports.meshopt_decodeIndexSequence, target, count, size, source);
|
|
39
|
+
}
|
|
40
|
+
export async function meshoptDecodeGltfBuffer(target, count, size, source, mode) {
|
|
41
|
+
let filter = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'NONE';
|
|
42
|
+
const instance = await loadWasmInstance();
|
|
43
|
+
decode(instance, instance.exports[DECODERS[mode]], target, count, size, source, instance.exports[FILTERS[filter || 'NONE']]);
|
|
44
|
+
}
|
|
45
|
+
let wasmPromise;
|
|
46
|
+
async function loadWasmInstance() {
|
|
47
|
+
if (!wasmPromise) {
|
|
48
|
+
wasmPromise = loadWasmModule();
|
|
49
|
+
}
|
|
50
|
+
return wasmPromise;
|
|
51
|
+
}
|
|
52
|
+
async function loadWasmModule() {
|
|
53
|
+
let wasm = wasm_base;
|
|
54
|
+
if (WebAssembly.validate(detector)) {
|
|
55
|
+
wasm = wasm_simd;
|
|
56
|
+
console.log('Warning: meshopt_decoder is using experimental SIMD support');
|
|
57
|
+
}
|
|
58
|
+
const result = await WebAssembly.instantiate(unpack(wasm), {});
|
|
59
|
+
await result.instance.exports.__wasm_call_ctors();
|
|
60
|
+
return result.instance;
|
|
61
|
+
}
|
|
62
|
+
function unpack(data) {
|
|
63
|
+
const result = new Uint8Array(data.length);
|
|
64
|
+
for (let i = 0; i < data.length; ++i) {
|
|
65
|
+
const ch = data.charCodeAt(i);
|
|
66
|
+
result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;
|
|
67
|
+
}
|
|
68
|
+
let write = 0;
|
|
69
|
+
for (let i = 0; i < data.length; ++i) {
|
|
70
|
+
result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];
|
|
71
|
+
}
|
|
72
|
+
return result.buffer.slice(0, write);
|
|
73
|
+
}
|
|
74
|
+
function decode(instance, fun, target, count, size, source, filter) {
|
|
75
|
+
const sbrk = instance.exports.sbrk;
|
|
76
|
+
const count4 = count + 3 & ~3;
|
|
77
|
+
const tp = sbrk(count4 * size);
|
|
78
|
+
const sp = sbrk(source.length);
|
|
79
|
+
const heap = new Uint8Array(instance.exports.memory.buffer);
|
|
80
|
+
heap.set(source, sp);
|
|
81
|
+
const res = fun(tp, count, size, sp, source.length);
|
|
82
|
+
if (res === 0 && filter) {
|
|
83
|
+
filter(tp, count4, size);
|
|
84
|
+
}
|
|
85
|
+
target.set(heap.subarray(tp, tp + count * size));
|
|
86
|
+
sbrk(tp - sbrk(0));
|
|
87
|
+
if (res !== 0) {
|
|
88
|
+
throw new Error("Malformed buffer data: ".concat(res));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=meshopt-decoder.js.map
|