@loaders.gl/gltf 3.4.0-alpha.1 → 3.4.0-alpha.3
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/dist.min.js +79 -27
- package/dist/es5/glb-loader.js +6 -9
- package/dist/es5/glb-loader.js.map +1 -1
- package/dist/es5/glb-writer.js +0 -3
- package/dist/es5/glb-writer.js.map +1 -1
- package/dist/es5/gltf-loader.js +15 -19
- package/dist/es5/gltf-loader.js.map +1 -1
- package/dist/es5/gltf-writer.js +0 -2
- package/dist/es5/gltf-writer.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/api/gltf-extensions.js +36 -43
- package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
- package/dist/es5/lib/api/gltf-scenegraph.js +31 -108
- package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -1
- package/dist/es5/lib/api/normalize-gltf-v1.js +8 -33
- package/dist/es5/lib/api/normalize-gltf-v1.js.map +1 -1
- package/dist/es5/lib/api/post-process-gltf.js +5 -22
- package/dist/es5/lib/api/post-process-gltf.js.map +1 -1
- package/dist/es5/lib/encoders/encode-glb.js +0 -16
- package/dist/es5/lib/encoders/encode-glb.js.map +1 -1
- package/dist/es5/lib/encoders/encode-gltf.js +0 -2
- package/dist/es5/lib/encoders/encode-gltf.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js +48 -54
- package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_texture_webp.js +2 -5
- package/dist/es5/lib/extensions/EXT_texture_webp.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_binary_gltf.js +1 -7
- package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +117 -134
- package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_texture_basisu.js +1 -4
- package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_texture_transform.js +18 -27
- package/dist/es5/lib/extensions/KHR_texture_transform.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +7 -14
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +52 -58
- package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +22 -26
- package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +31 -40
- package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
- package/dist/es5/lib/gltf-utils/get-typed-array.js +0 -3
- package/dist/es5/lib/gltf-utils/get-typed-array.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +0 -5
- package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-constants.js +0 -2
- package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -1
- package/dist/es5/lib/gltf-utils/resolve-url.js.map +1 -1
- package/dist/es5/lib/parsers/parse-glb.js +0 -16
- package/dist/es5/lib/parsers/parse-glb.js.map +1 -1
- package/dist/es5/lib/parsers/parse-gltf.js +145 -164
- package/dist/es5/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/es5/lib/utils/assert.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/es5/meshopt/meshopt-decoder.js +69 -87
- package/dist/es5/meshopt/meshopt-decoder.js.map +1 -1
- package/dist/es5/webp/webp.js +40 -45
- package/dist/es5/webp/webp.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/glb-loader.js +0 -2
- package/dist/esm/glb-loader.js.map +1 -1
- package/dist/esm/glb-writer.js +0 -4
- package/dist/esm/glb-writer.js.map +1 -1
- package/dist/esm/gltf-loader.js +0 -2
- package/dist/esm/gltf-loader.js.map +1 -1
- package/dist/esm/gltf-writer.js +0 -2
- package/dist/esm/gltf-writer.js.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api/gltf-extensions.js +1 -10
- package/dist/esm/lib/api/gltf-extensions.js.map +1 -1
- package/dist/esm/lib/api/gltf-scenegraph.js +2 -48
- package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -1
- package/dist/esm/lib/api/normalize-gltf-v1.js +0 -17
- package/dist/esm/lib/api/normalize-gltf-v1.js.map +1 -1
- package/dist/esm/lib/api/post-process-gltf.js +2 -16
- package/dist/esm/lib/api/post-process-gltf.js.map +1 -1
- package/dist/esm/lib/encoders/encode-glb.js +0 -16
- package/dist/esm/lib/encoders/encode-glb.js.map +1 -1
- package/dist/esm/lib/encoders/encode-gltf.js +0 -2
- package/dist/esm/lib/encoders/encode-gltf.js.map +1 -1
- package/dist/esm/lib/extensions/EXT_meshopt_compression.js +0 -7
- package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +1 -1
- package/dist/esm/lib/extensions/EXT_texture_webp.js +2 -7
- package/dist/esm/lib/extensions/EXT_texture_webp.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_binary_gltf.js +0 -6
- package/dist/esm/lib/extensions/KHR_binary_gltf.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js +1 -18
- package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_texture_basisu.js +0 -5
- package/dist/esm/lib/extensions/KHR_texture_basisu.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_texture_transform.js +0 -11
- package/dist/esm/lib/extensions/KHR_texture_transform.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +0 -7
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js +0 -7
- package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js +0 -5
- package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js +3 -11
- package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
- package/dist/esm/lib/gltf-utils/get-typed-array.js +0 -4
- package/dist/esm/lib/gltf-utils/get-typed-array.js.map +1 -1
- package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js +0 -7
- package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
- package/dist/esm/lib/gltf-utils/gltf-constants.js +0 -1
- package/dist/esm/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/esm/lib/gltf-utils/gltf-utils.js.map +1 -1
- package/dist/esm/lib/gltf-utils/resolve-url.js +0 -1
- package/dist/esm/lib/gltf-utils/resolve-url.js.map +1 -1
- package/dist/esm/lib/parsers/parse-glb.js +0 -17
- package/dist/esm/lib/parsers/parse-glb.js.map +1 -1
- package/dist/esm/lib/parsers/parse-gltf.js +0 -18
- package/dist/esm/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/esm/lib/utils/assert.js +0 -1
- package/dist/esm/lib/utils/assert.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -2
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/esm/meshopt/meshopt-decoder.js +0 -8
- package/dist/esm/meshopt/meshopt-decoder.js.map +1 -1
- package/dist/esm/webp/webp.js +0 -2
- package/dist/esm/webp/webp.js.map +1 -1
- package/dist/gltf-loader.d.ts +2 -1
- package/dist/gltf-loader.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.js +1 -1
- package/dist/lib/extensions/EXT_texture_webp.js +1 -1
- package/dist/lib/parsers/parse-gltf.d.ts +1 -1
- package/dist/lib/parsers/parse-gltf.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/lib/extensions/EXT_texture_webp.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glb-writer.js","names":["VERSION","encodeGLBSync","GLBWriter","name","id","module","version","extensions","mimeTypes","binary","encodeSync","options","glb","byteOffset","byteLength","arrayBuffer","ArrayBuffer","dataView","DataView","_TypecheckGLBLoader"],"sources":["../../src/glb-writer.ts"],"sourcesContent":["import type {Writer} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport encodeGLBSync from './lib/encoders/encode-glb';\n\n/**\n * GLB exporter\n * GLB is the binary container format for GLTF\n */\nexport const GLBWriter = {\n name: 'GLB',\n id: 'glb',\n module: 'gltf',\n version: VERSION,\n\n extensions: ['glb'],\n mimeTypes: ['model/gltf-binary'],\n binary: true,\n\n encodeSync,\n\n options: {\n glb: {}\n }\n};\n\nfunction encodeSync(glb, options) {\n const {byteOffset = 0} = options;\n\n // Calculate length and allocate buffer\n const byteLength = encodeGLBSync(glb, null, byteOffset, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n\n // Encode into buffer\n const dataView = new DataView(arrayBuffer);\n encodeGLBSync(glb, dataView, byteOffset, options);\n\n return arrayBuffer;\n}\n\n// TYPE TESTS - TODO find a better way than exporting junk\nexport const _TypecheckGLBLoader: Writer = GLBWriter;\n"],"mappings":"AACA,SAAQA,OAAO,QAAO,qBAAqB;AAC3C,OAAOC,aAAa,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"glb-writer.js","names":["VERSION","encodeGLBSync","GLBWriter","name","id","module","version","extensions","mimeTypes","binary","encodeSync","options","glb","byteOffset","byteLength","arrayBuffer","ArrayBuffer","dataView","DataView","_TypecheckGLBLoader"],"sources":["../../src/glb-writer.ts"],"sourcesContent":["import type {Writer} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport encodeGLBSync from './lib/encoders/encode-glb';\n\n/**\n * GLB exporter\n * GLB is the binary container format for GLTF\n */\nexport const GLBWriter = {\n name: 'GLB',\n id: 'glb',\n module: 'gltf',\n version: VERSION,\n\n extensions: ['glb'],\n mimeTypes: ['model/gltf-binary'],\n binary: true,\n\n encodeSync,\n\n options: {\n glb: {}\n }\n};\n\nfunction encodeSync(glb, options) {\n const {byteOffset = 0} = options;\n\n // Calculate length and allocate buffer\n const byteLength = encodeGLBSync(glb, null, byteOffset, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n\n // Encode into buffer\n const dataView = new DataView(arrayBuffer);\n encodeGLBSync(glb, dataView, byteOffset, options);\n\n return arrayBuffer;\n}\n\n// TYPE TESTS - TODO find a better way than exporting junk\nexport const _TypecheckGLBLoader: Writer = GLBWriter;\n"],"mappings":"AACA,SAAQA,OAAO,QAAO,qBAAqB;AAC3C,OAAOC,aAAa,MAAM,2BAA2B;AAMrD,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,KAAK;EACXC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEN,OAAO;EAEhBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;EAChCC,MAAM,EAAE,IAAI;EAEZC,UAAU;EAEVC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,SAASF,UAAUA,CAACE,GAAG,EAAED,OAAO,EAAE;EAChC,MAAM;IAACE,UAAU,GAAG;EAAC,CAAC,GAAGF,OAAO;EAGhC,MAAMG,UAAU,GAAGb,aAAa,CAACW,GAAG,EAAE,IAAI,EAAEC,UAAU,EAAEF,OAAO,CAAC;EAChE,MAAMI,WAAW,GAAG,IAAIC,WAAW,CAACF,UAAU,CAAC;EAG/C,MAAMG,QAAQ,GAAG,IAAIC,QAAQ,CAACH,WAAW,CAAC;EAC1Cd,aAAa,CAACW,GAAG,EAAEK,QAAQ,EAAEJ,UAAU,EAAEF,OAAO,CAAC;EAEjD,OAAOI,WAAW;AACpB;AAGA,OAAO,MAAMI,mBAA2B,GAAGjB,SAAS"}
|
package/dist/esm/gltf-loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-loader.js","names":["VERSION","parseGLTF","GLTFLoader","name","id","module","version","extensions","mimeTypes","text","binary","tests","parse","options","gltf","normalize","loadBuffers","loadImages","decompressMeshes","postProcess","log","console","deprecatedOptions","fetchImages","createImages","decompress","arrayBuffer","context","byteOffset"],"sources":["../../src/gltf-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {DracoLoaderOptions} from '@loaders.gl/draco';\nimport {VERSION} from './lib/utils/version';\nimport type {ImageLoaderOptions} from '@loaders.gl/images';\nimport type {TextureLoaderOptions} from '@loaders.gl/textures';\nimport type {GLTFParseOptions} from './lib/parsers/parse-gltf';\nimport type {GLTFWithBuffers} from './lib/types/gltf-types';\nimport {parseGLTF} from './lib/parsers/parse-gltf';\nimport {GLBLoaderOptions} from './glb-loader';\n\n/**\n * GLTF loader options\n */\nexport type GLTFLoaderOptions = LoaderOptions &\n ImageLoaderOptions &\n TextureLoaderOptions &\n GLBLoaderOptions &\n DracoLoaderOptions & {\n gltf?: GLTFParseOptions;\n };\n\n/**\n * GLTF loader\n */\nexport const GLTFLoader: LoaderWithParser = {\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n extensions: ['gltf', 'glb'],\n mimeTypes: ['model/gltf+json', 'model/gltf-binary'],\n\n text: true,\n binary: true,\n tests: ['glTF'],\n parse,\n\n options: {\n gltf: {\n normalize: true, // Normalize glTF v1 to glTF v2 format (not yet stable)\n loadBuffers: true, // Fetch any linked .BIN buffers, decode base64\n loadImages: true, // Create image objects\n decompressMeshes: true, // Decompress Draco encoded meshes\n postProcess: true // Postprocess glTF and return json structure directly\n },\n\n // common?\n log: console // eslint-disable-line\n },\n deprecatedOptions: {\n fetchImages: 'gltf.loadImages',\n createImages: 'gltf.loadImages',\n decompress: 'gltf.decompressMeshes',\n postProcess: 'gltf.postProcess',\n gltf: {\n decompress: 'gltf.decompressMeshes'\n }\n }\n};\n\nexport async function parse(arrayBuffer, options: GLTFLoaderOptions = {}, context) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GLTFLoader.options, ...options};\n // @ts-ignore\n options.gltf = {...GLTFLoader.options.gltf, ...options.gltf};\n\n const {byteOffset = 0} = options;\n const gltf = {};\n return await parseGLTF(gltf as GLTFWithBuffers, arrayBuffer, byteOffset, options, context);\n}\n"],"mappings":"AAEA,SAAQA,OAAO,QAAO,qBAAqB;AAK3C,SAAQC,SAAS,QAAO,0BAA0B;AAiBlD,OAAO,MAAMC,UAA4B,GAAG;EAC1CC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;EAC3BC,SAAS,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;EAEnDC,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,MAAM,CAAC;EACfC,KAAK;EAELC,OAAO,EAAE;IACPC,IAAI,EAAE;MACJC,SAAS,EAAE,IAAI;MACfC,WAAW,EAAE,IAAI;MACjBC,UAAU,EAAE,IAAI;MAChBC,gBAAgB,EAAE,IAAI;MACtBC,WAAW,EAAE;IACf,CAAC
|
|
1
|
+
{"version":3,"file":"gltf-loader.js","names":["VERSION","parseGLTF","GLTFLoader","name","id","module","version","extensions","mimeTypes","text","binary","tests","parse","options","gltf","normalize","loadBuffers","loadImages","decompressMeshes","postProcess","log","console","deprecatedOptions","fetchImages","createImages","decompress","arrayBuffer","arguments","length","undefined","context","byteOffset"],"sources":["../../src/gltf-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {DracoLoaderOptions} from '@loaders.gl/draco';\nimport {VERSION} from './lib/utils/version';\nimport type {ImageLoaderOptions} from '@loaders.gl/images';\nimport type {TextureLoaderOptions} from '@loaders.gl/textures';\nimport type {GLTFParseOptions} from './lib/parsers/parse-gltf';\nimport type {GLTFWithBuffers} from './lib/types/gltf-types';\nimport {parseGLTF} from './lib/parsers/parse-gltf';\nimport {GLBLoaderOptions} from './glb-loader';\n\n/**\n * GLTF loader options\n */\nexport type GLTFLoaderOptions = LoaderOptions &\n ImageLoaderOptions &\n TextureLoaderOptions &\n GLBLoaderOptions &\n DracoLoaderOptions & {\n gltf?: GLTFParseOptions;\n };\n\n/**\n * GLTF loader\n */\nexport const GLTFLoader: LoaderWithParser = {\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n extensions: ['gltf', 'glb'],\n mimeTypes: ['model/gltf+json', 'model/gltf-binary'],\n\n text: true,\n binary: true,\n tests: ['glTF'],\n parse,\n\n options: {\n gltf: {\n normalize: true, // Normalize glTF v1 to glTF v2 format (not yet stable)\n loadBuffers: true, // Fetch any linked .BIN buffers, decode base64\n loadImages: true, // Create image objects\n decompressMeshes: true, // Decompress Draco encoded meshes\n postProcess: true // Postprocess glTF and return json structure directly\n },\n\n // common?\n log: console // eslint-disable-line\n },\n deprecatedOptions: {\n fetchImages: 'gltf.loadImages',\n createImages: 'gltf.loadImages',\n decompress: 'gltf.decompressMeshes',\n postProcess: 'gltf.postProcess',\n gltf: {\n decompress: 'gltf.decompressMeshes'\n }\n }\n};\n\nexport async function parse(arrayBuffer, options: GLTFLoaderOptions = {}, context) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GLTFLoader.options, ...options};\n // @ts-ignore\n options.gltf = {...GLTFLoader.options.gltf, ...options.gltf};\n\n const {byteOffset = 0} = options;\n const gltf = {};\n return await parseGLTF(gltf as GLTFWithBuffers, arrayBuffer, byteOffset, options, context);\n}\n"],"mappings":"AAEA,SAAQA,OAAO,QAAO,qBAAqB;AAK3C,SAAQC,SAAS,QAAO,0BAA0B;AAiBlD,OAAO,MAAMC,UAA4B,GAAG;EAC1CC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;EAC3BC,SAAS,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;EAEnDC,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,MAAM,CAAC;EACfC,KAAK;EAELC,OAAO,EAAE;IACPC,IAAI,EAAE;MACJC,SAAS,EAAE,IAAI;MACfC,WAAW,EAAE,IAAI;MACjBC,UAAU,EAAE,IAAI;MAChBC,gBAAgB,EAAE,IAAI;MACtBC,WAAW,EAAE;IACf,CAAC;IAGDC,GAAG,EAAEC;EACP,CAAC;EACDC,iBAAiB,EAAE;IACjBC,WAAW,EAAE,iBAAiB;IAC9BC,YAAY,EAAE,iBAAiB;IAC/BC,UAAU,EAAE,uBAAuB;IACnCN,WAAW,EAAE,kBAAkB;IAC/BL,IAAI,EAAE;MACJW,UAAU,EAAE;IACd;EACF;AACF,CAAC;AAED,OAAO,eAAeb,KAAKA,CAACc,WAAW,EAA4C;EAAA,IAA1Cb,OAA0B,GAAAc,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAAEG,OAAO,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAE/EhB,OAAO,GAAG;IAAC,GAAGX,UAAU,CAACW,OAAO;IAAE,GAAGA;EAAO,CAAC;EAE7CA,OAAO,CAACC,IAAI,GAAG;IAAC,GAAGZ,UAAU,CAACW,OAAO,CAACC,IAAI;IAAE,GAAGD,OAAO,CAACC;EAAI,CAAC;EAE5D,MAAM;IAACiB,UAAU,GAAG;EAAC,CAAC,GAAGlB,OAAO;EAChC,MAAMC,IAAI,GAAG,CAAC,CAAC;EACf,OAAO,MAAMb,SAAS,CAACa,IAAI,EAAqBY,WAAW,EAAEK,UAAU,EAAElB,OAAO,EAAEiB,OAAO,CAAC;AAC5F"}
|
package/dist/esm/gltf-writer.js
CHANGED
|
@@ -18,13 +18,11 @@ function encodeSync(gltf) {
|
|
|
18
18
|
const {
|
|
19
19
|
byteOffset = 0
|
|
20
20
|
} = options;
|
|
21
|
-
|
|
22
21
|
const byteLength = encodeGLTFSync(gltf, null, byteOffset, options);
|
|
23
22
|
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
24
23
|
const dataView = new DataView(arrayBuffer);
|
|
25
24
|
encodeGLTFSync(gltf, dataView, byteOffset, options);
|
|
26
25
|
return arrayBuffer;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
export const _TypecheckGLBLoader = GLTFWriter;
|
|
30
28
|
//# sourceMappingURL=gltf-writer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-writer.js","names":["VERSION","encodeGLTFSync","GLTFWriter","name","id","module","version","extensions","mimeTypes","binary","encodeSync","options","gltf","byteOffset","byteLength","arrayBuffer","ArrayBuffer","dataView","DataView","_TypecheckGLBLoader"],"sources":["../../src/gltf-writer.ts"],"sourcesContent":["import type {Writer, WriterOptions} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {encodeGLTFSync} from './lib/encoders/encode-gltf';\n\nexport type GLTFWriterOptions = WriterOptions & {\n gltf?: {};\n byteOffset?: number;\n};\n\n/**\n * GLTF exporter\n */\nexport const GLTFWriter = {\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n\n extensions: ['glb'], // We only support encoding to binary GLB, not to JSON GLTF\n mimeTypes: ['model/gltf-binary'], // 'model/gltf+json',\n binary: true,\n\n encodeSync,\n\n options: {\n gltf: {}\n }\n};\n\nfunction encodeSync(gltf, options: GLTFWriterOptions = {}) {\n const {byteOffset = 0} = options;\n\n // Calculate length, then create arraybuffer and encode\n const byteLength = encodeGLTFSync(gltf, null, byteOffset, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n const dataView = new DataView(arrayBuffer);\n encodeGLTFSync(gltf, dataView, byteOffset, options);\n\n return arrayBuffer;\n}\n\n// TYPE TESTS - TODO find a better way than exporting junk\nexport const _TypecheckGLBLoader: Writer = GLTFWriter;\n"],"mappings":"AACA,SAAQA,OAAO,QAAO,qBAAqB;AAC3C,SAAQC,cAAc,QAAO,4BAA4B;AAUzD,OAAO,MAAMC,UAAU,GAAG;EACxBC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEN,OAAO;EAEhBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;EAChCC,MAAM,EAAE,IAAI;EAEZC,UAAU;EAEVC,OAAO,EAAE;IACPC,IAAI,EAAE,CAAC;EACT;AACF,CAAC;AAED,SAASF,
|
|
1
|
+
{"version":3,"file":"gltf-writer.js","names":["VERSION","encodeGLTFSync","GLTFWriter","name","id","module","version","extensions","mimeTypes","binary","encodeSync","options","gltf","arguments","length","undefined","byteOffset","byteLength","arrayBuffer","ArrayBuffer","dataView","DataView","_TypecheckGLBLoader"],"sources":["../../src/gltf-writer.ts"],"sourcesContent":["import type {Writer, WriterOptions} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {encodeGLTFSync} from './lib/encoders/encode-gltf';\n\nexport type GLTFWriterOptions = WriterOptions & {\n gltf?: {};\n byteOffset?: number;\n};\n\n/**\n * GLTF exporter\n */\nexport const GLTFWriter = {\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n\n extensions: ['glb'], // We only support encoding to binary GLB, not to JSON GLTF\n mimeTypes: ['model/gltf-binary'], // 'model/gltf+json',\n binary: true,\n\n encodeSync,\n\n options: {\n gltf: {}\n }\n};\n\nfunction encodeSync(gltf, options: GLTFWriterOptions = {}) {\n const {byteOffset = 0} = options;\n\n // Calculate length, then create arraybuffer and encode\n const byteLength = encodeGLTFSync(gltf, null, byteOffset, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n const dataView = new DataView(arrayBuffer);\n encodeGLTFSync(gltf, dataView, byteOffset, options);\n\n return arrayBuffer;\n}\n\n// TYPE TESTS - TODO find a better way than exporting junk\nexport const _TypecheckGLBLoader: Writer = GLTFWriter;\n"],"mappings":"AACA,SAAQA,OAAO,QAAO,qBAAqB;AAC3C,SAAQC,cAAc,QAAO,4BAA4B;AAUzD,OAAO,MAAMC,UAAU,GAAG;EACxBC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEN,OAAO;EAEhBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;EAChCC,MAAM,EAAE,IAAI;EAEZC,UAAU;EAEVC,OAAO,EAAE;IACPC,IAAI,EAAE,CAAC;EACT;AACF,CAAC;AAED,SAASF,UAAUA,CAACE,IAAI,EAAmC;EAAA,IAAjCD,OAA0B,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACvD,MAAM;IAACG,UAAU,GAAG;EAAC,CAAC,GAAGL,OAAO;EAGhC,MAAMM,UAAU,GAAGhB,cAAc,CAACW,IAAI,EAAE,IAAI,EAAEI,UAAU,EAAEL,OAAO,CAAC;EAClE,MAAMO,WAAW,GAAG,IAAIC,WAAW,CAACF,UAAU,CAAC;EAC/C,MAAMG,QAAQ,GAAG,IAAIC,QAAQ,CAACH,WAAW,CAAC;EAC1CjB,cAAc,CAACW,IAAI,EAAEQ,QAAQ,EAAEJ,UAAU,EAAEL,OAAO,CAAC;EAEnD,OAAOO,WAAW;AACpB;AAGA,OAAO,MAAMI,mBAA2B,GAAGpB,UAAU"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
export { GLTFLoader } from './gltf-loader';
|
|
4
2
|
export { GLTFWriter } from './gltf-writer';
|
|
5
|
-
|
|
6
3
|
export { GLBLoader } from './glb-loader';
|
|
7
4
|
export { GLBWriter } from './glb-writer';
|
|
8
|
-
|
|
9
5
|
export { default as GLTFScenegraph } from './lib/api/gltf-scenegraph';
|
|
10
6
|
export { postProcessGLTF } from './lib/api/post-process-gltf';
|
|
11
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["GLTFLoader","GLTFWriter","GLBLoader","GLBWriter","default","GLTFScenegraph","postProcessGLTF"],"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable camelcase, indent */\nexport type {GLB} from './lib/types/glb-types';\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 GLTFPostprocessed,\n GLTFAccessorPostprocessed,\n GLTFNodePostprocessed,\n GLTFMaterialPostprocessed,\n GLTFMeshPostprocessed,\n GLTFMeshPrimitivePostprocessed,\n GLTFImagePostprocessed,\n GLTFTexturePostprocessed,\n // The following extensions are handled by the GLTFLoader and removed from the parsed glTF (disable via options.gltf.excludeExtensions)\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 './lib/types/gltf-types';\n\n// glTF loader/writer definition objects\nexport {GLTFLoader} from './gltf-loader';\nexport {GLTFWriter} from './gltf-writer';\n\n// GLB Loader & Writer (for custom formats that want to leverage the GLB binary \"envelope\")\nexport {GLBLoader} from './glb-loader';\nexport {GLBWriter} from './glb-writer';\n\n// glTF Data Access Helper Class\nexport {default as GLTFScenegraph} from './lib/api/gltf-scenegraph';\nexport {postProcessGLTF} from './lib/api/post-process-gltf';\nexport type {Mesh} from './lib/types/gltf-json-schema';\nexport type {GLTFObject} from './lib/types/gltf-types';\nexport type {Node, Accessor, Image} from './lib/types/gltf-postprocessed-schema';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["GLTFLoader","GLTFWriter","GLBLoader","GLBWriter","default","GLTFScenegraph","postProcessGLTF"],"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable camelcase, indent */\nexport type {GLB} from './lib/types/glb-types';\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 GLTFPostprocessed,\n GLTFAccessorPostprocessed,\n GLTFNodePostprocessed,\n GLTFMaterialPostprocessed,\n GLTFMeshPostprocessed,\n GLTFMeshPrimitivePostprocessed,\n GLTFImagePostprocessed,\n GLTFTexturePostprocessed,\n // The following extensions are handled by the GLTFLoader and removed from the parsed glTF (disable via options.gltf.excludeExtensions)\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 './lib/types/gltf-types';\n\n// glTF loader/writer definition objects\nexport {GLTFLoader} from './gltf-loader';\nexport {GLTFWriter} from './gltf-writer';\n\n// GLB Loader & Writer (for custom formats that want to leverage the GLB binary \"envelope\")\nexport {GLBLoader} from './glb-loader';\nexport {GLBWriter} from './glb-writer';\n\n// glTF Data Access Helper Class\nexport {default as GLTFScenegraph} from './lib/api/gltf-scenegraph';\nexport {postProcessGLTF} from './lib/api/post-process-gltf';\nexport type {Mesh} from './lib/types/gltf-json-schema';\nexport type {GLTFObject} from './lib/types/gltf-types';\nexport type {Node, Accessor, Image} from './lib/types/gltf-postprocessed-schema';\n"],"mappings":"AAkCA,SAAQA,UAAU,QAAO,eAAe;AACxC,SAAQC,UAAU,QAAO,eAAe;AAGxC,SAAQC,SAAS,QAAO,cAAc;AACtC,SAAQC,SAAS,QAAO,cAAc;AAGtC,SAAQC,OAAO,IAAIC,cAAc,QAAO,2BAA2B;AACnE,SAAQC,eAAe,QAAO,6BAA6B"}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
import * as EXT_meshopt_compression from '../extensions/EXT_meshopt_compression';
|
|
4
2
|
import * as EXT_texture_webp from '../extensions/EXT_texture_webp';
|
|
5
3
|
import * as KHR_texture_basisu from '../extensions/KHR_texture_basisu';
|
|
6
4
|
import * as KHR_draco_mesh_compression from '../extensions/KHR_draco_mesh_compression';
|
|
7
5
|
import * as KHR_texture_transform from '../extensions/KHR_texture_transform';
|
|
8
|
-
|
|
9
6
|
import * as KHR_lights_punctual from '../extensions/deprecated/KHR_lights_punctual';
|
|
10
7
|
import * as KHR_materials_unlit from '../extensions/deprecated/KHR_materials_unlit';
|
|
11
8
|
import * as KHR_techniques_webgl from '../extensions/deprecated/KHR_techniques_webgl';
|
|
12
9
|
import * as EXT_feature_metadata from '../extensions/deprecated/EXT_feature_metadata';
|
|
13
|
-
|
|
14
|
-
export const EXTENSIONS = [
|
|
15
|
-
|
|
16
|
-
EXT_meshopt_compression, EXT_texture_webp,
|
|
17
|
-
KHR_texture_basisu, KHR_draco_mesh_compression, KHR_lights_punctual, KHR_materials_unlit, KHR_techniques_webgl, KHR_texture_transform, EXT_feature_metadata];
|
|
18
|
-
|
|
10
|
+
export const EXTENSIONS = [EXT_meshopt_compression, EXT_texture_webp, KHR_texture_basisu, KHR_draco_mesh_compression, KHR_lights_punctual, KHR_materials_unlit, KHR_techniques_webgl, KHR_texture_transform, EXT_feature_metadata];
|
|
19
11
|
export function preprocessExtensions(gltf) {
|
|
20
12
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
21
13
|
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -25,7 +17,6 @@ export function preprocessExtensions(gltf) {
|
|
|
25
17
|
(_extension$preprocess = extension.preprocess) === null || _extension$preprocess === void 0 ? void 0 : _extension$preprocess.call(extension, gltf, options, context);
|
|
26
18
|
}
|
|
27
19
|
}
|
|
28
|
-
|
|
29
20
|
export async function decodeExtensions(gltf) {
|
|
30
21
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
22
|
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-extensions.js","names":["EXT_meshopt_compression","EXT_texture_webp","KHR_texture_basisu","KHR_draco_mesh_compression","KHR_texture_transform","KHR_lights_punctual","KHR_materials_unlit","KHR_techniques_webgl","EXT_feature_metadata","EXTENSIONS","preprocessExtensions","gltf","options","context","extensions","filter","extension","useExtension","name","preprocess","decodeExtensions","decode","extensionName","excludes","excludeExtensions","exclude"],"sources":["../../../../src/lib/api/gltf-extensions.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport {GLTF} from '../types/gltf-types';\nimport type {GLTFLoaderOptions} from '../../gltf-loader';\n\n// GLTF 1.0 extensions (decode only)\n// import * as KHR_binary_gltf from './KHR_draco_mesh_compression';\n\n// GLTF 2.0 Khronos extensions (decode/encode)\nimport * as EXT_meshopt_compression from '../extensions/EXT_meshopt_compression';\nimport * as EXT_texture_webp from '../extensions/EXT_texture_webp';\nimport * as KHR_texture_basisu from '../extensions/KHR_texture_basisu';\nimport * as KHR_draco_mesh_compression from '../extensions/KHR_draco_mesh_compression';\nimport * as KHR_texture_transform from '../extensions/KHR_texture_transform';\n\n// Deprecated. These should be handled by rendering library (e.g. luma.gl), not the loader.\nimport * as KHR_lights_punctual from '../extensions/deprecated/KHR_lights_punctual';\nimport * as KHR_materials_unlit from '../extensions/deprecated/KHR_materials_unlit';\nimport * as KHR_techniques_webgl from '../extensions/deprecated/KHR_techniques_webgl';\nimport * as EXT_feature_metadata from '../extensions/deprecated/EXT_feature_metadata';\n\n// Vendor extensions\n\ntype GLTFExtensionPlugin = {\n name: string;\n preprocess?: (gltfData: {json: GLTF}, options: GLTFLoaderOptions, context) => void;\n decode?: (\n gltfData: {\n json: GLTF;\n buffers: {arrayBuffer: ArrayBuffer; byteOffset: number; byteLength: number}[];\n },\n options: GLTFLoaderOptions,\n context\n ) => Promise<void>;\n encode?: (gltfData: {json: GLTF}, options: GLTFLoaderOptions) => void;\n};\n\n/**\n * List of extensions processed by the GLTFLoader\n * Note that may extensions can only be handled on the rendering stage and are left out here\n * These are just extensions that can be handled fully or partially during loading.\n */\nexport const EXTENSIONS: GLTFExtensionPlugin[] = [\n // 1.0\n // KHR_binary_gltf is handled separately - must be processed before other parsing starts\n // KHR_binary_gltf,\n\n // 2.0\n EXT_meshopt_compression,\n EXT_texture_webp,\n // Basisu should come after webp, we want basisu to be preferred if both are provided\n KHR_texture_basisu,\n KHR_draco_mesh_compression,\n KHR_lights_punctual,\n KHR_materials_unlit,\n KHR_techniques_webgl,\n KHR_texture_transform,\n EXT_feature_metadata\n];\n\n/** Call before any resource loading starts */\nexport function preprocessExtensions(gltf, options: GLTFLoaderOptions = {}, context?) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n extension.preprocess?.(gltf, options, context);\n }\n}\n\n/** Call after resource loading */\nexport async function decodeExtensions(gltf, options: GLTFLoaderOptions = {}, context?) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n // Note: We decode async extensions sequentially, this might not be necessary\n // Currently we only have Draco, but when we add Basis we may revisit\n await extension.decode?.(gltf, options, context);\n }\n}\n\nfunction useExtension(extensionName: string, options: GLTFLoaderOptions) {\n const excludes = options?.gltf?.excludeExtensions || {};\n const exclude = extensionName in excludes && !excludes[extensionName];\n return !exclude;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"gltf-extensions.js","names":["EXT_meshopt_compression","EXT_texture_webp","KHR_texture_basisu","KHR_draco_mesh_compression","KHR_texture_transform","KHR_lights_punctual","KHR_materials_unlit","KHR_techniques_webgl","EXT_feature_metadata","EXTENSIONS","preprocessExtensions","gltf","options","arguments","length","undefined","context","extensions","filter","extension","useExtension","name","_extension$preprocess","preprocess","call","decodeExtensions","_extension$decode","decode","extensionName","_options$gltf","excludes","excludeExtensions","exclude"],"sources":["../../../../src/lib/api/gltf-extensions.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport {GLTF} from '../types/gltf-types';\nimport type {GLTFLoaderOptions} from '../../gltf-loader';\n\n// GLTF 1.0 extensions (decode only)\n// import * as KHR_binary_gltf from './KHR_draco_mesh_compression';\n\n// GLTF 2.0 Khronos extensions (decode/encode)\nimport * as EXT_meshopt_compression from '../extensions/EXT_meshopt_compression';\nimport * as EXT_texture_webp from '../extensions/EXT_texture_webp';\nimport * as KHR_texture_basisu from '../extensions/KHR_texture_basisu';\nimport * as KHR_draco_mesh_compression from '../extensions/KHR_draco_mesh_compression';\nimport * as KHR_texture_transform from '../extensions/KHR_texture_transform';\n\n// Deprecated. These should be handled by rendering library (e.g. luma.gl), not the loader.\nimport * as KHR_lights_punctual from '../extensions/deprecated/KHR_lights_punctual';\nimport * as KHR_materials_unlit from '../extensions/deprecated/KHR_materials_unlit';\nimport * as KHR_techniques_webgl from '../extensions/deprecated/KHR_techniques_webgl';\nimport * as EXT_feature_metadata from '../extensions/deprecated/EXT_feature_metadata';\n\n// Vendor extensions\n\ntype GLTFExtensionPlugin = {\n name: string;\n preprocess?: (gltfData: {json: GLTF}, options: GLTFLoaderOptions, context) => void;\n decode?: (\n gltfData: {\n json: GLTF;\n buffers: {arrayBuffer: ArrayBuffer; byteOffset: number; byteLength: number}[];\n },\n options: GLTFLoaderOptions,\n context\n ) => Promise<void>;\n encode?: (gltfData: {json: GLTF}, options: GLTFLoaderOptions) => void;\n};\n\n/**\n * List of extensions processed by the GLTFLoader\n * Note that may extensions can only be handled on the rendering stage and are left out here\n * These are just extensions that can be handled fully or partially during loading.\n */\nexport const EXTENSIONS: GLTFExtensionPlugin[] = [\n // 1.0\n // KHR_binary_gltf is handled separately - must be processed before other parsing starts\n // KHR_binary_gltf,\n\n // 2.0\n EXT_meshopt_compression,\n EXT_texture_webp,\n // Basisu should come after webp, we want basisu to be preferred if both are provided\n KHR_texture_basisu,\n KHR_draco_mesh_compression,\n KHR_lights_punctual,\n KHR_materials_unlit,\n KHR_techniques_webgl,\n KHR_texture_transform,\n EXT_feature_metadata\n];\n\n/** Call before any resource loading starts */\nexport function preprocessExtensions(gltf, options: GLTFLoaderOptions = {}, context?) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n extension.preprocess?.(gltf, options, context);\n }\n}\n\n/** Call after resource loading */\nexport async function decodeExtensions(gltf, options: GLTFLoaderOptions = {}, context?) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n // Note: We decode async extensions sequentially, this might not be necessary\n // Currently we only have Draco, but when we add Basis we may revisit\n await extension.decode?.(gltf, options, context);\n }\n}\n\nfunction useExtension(extensionName: string, options: GLTFLoaderOptions) {\n const excludes = options?.gltf?.excludeExtensions || {};\n const exclude = extensionName in excludes && !excludes[extensionName];\n return !exclude;\n}\n"],"mappings":"AAQA,OAAO,KAAKA,uBAAuB,MAAM,uCAAuC;AAChF,OAAO,KAAKC,gBAAgB,MAAM,gCAAgC;AAClE,OAAO,KAAKC,kBAAkB,MAAM,kCAAkC;AACtE,OAAO,KAAKC,0BAA0B,MAAM,0CAA0C;AACtF,OAAO,KAAKC,qBAAqB,MAAM,qCAAqC;AAG5E,OAAO,KAAKC,mBAAmB,MAAM,8CAA8C;AACnF,OAAO,KAAKC,mBAAmB,MAAM,8CAA8C;AACnF,OAAO,KAAKC,oBAAoB,MAAM,+CAA+C;AACrF,OAAO,KAAKC,oBAAoB,MAAM,+CAA+C;AAuBrF,OAAO,MAAMC,UAAiC,GAAG,CAM/CT,uBAAuB,EACvBC,gBAAgB,EAEhBC,kBAAkB,EAClBC,0BAA0B,EAC1BE,mBAAmB,EACnBC,mBAAmB,EACnBC,oBAAoB,EACpBH,qBAAqB,EACrBI,oBAAoB,CACrB;AAGD,OAAO,SAASE,oBAAoBA,CAACC,IAAI,EAA6C;EAAA,IAA3CC,OAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAAEG,OAAQ,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAClF,MAAME,UAAU,GAAGR,UAAU,CAACS,MAAM,CAAEC,SAAS,IAAKC,YAAY,CAACD,SAAS,CAACE,IAAI,EAAET,OAAO,CAAC,CAAC;EAC1F,KAAK,MAAMO,SAAS,IAAIF,UAAU,EAAE;IAAA,IAAAK,qBAAA;IAClC,CAAAA,qBAAA,GAAAH,SAAS,CAACI,UAAU,cAAAD,qBAAA,uBAApBA,qBAAA,CAAAE,IAAA,CAAAL,SAAS,EAAcR,IAAI,EAAEC,OAAO,EAAEI,OAAO,CAAC;EAChD;AACF;AAGA,OAAO,eAAeS,gBAAgBA,CAACd,IAAI,EAA6C;EAAA,IAA3CC,OAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAAEG,OAAQ,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EACpF,MAAME,UAAU,GAAGR,UAAU,CAACS,MAAM,CAAEC,SAAS,IAAKC,YAAY,CAACD,SAAS,CAACE,IAAI,EAAET,OAAO,CAAC,CAAC;EAC1F,KAAK,MAAMO,SAAS,IAAIF,UAAU,EAAE;IAAA,IAAAS,iBAAA;IAGlC,QAAAA,iBAAA,GAAMP,SAAS,CAACQ,MAAM,cAAAD,iBAAA,uBAAhBA,iBAAA,CAAAF,IAAA,CAAAL,SAAS,EAAUR,IAAI,EAAEC,OAAO,EAAEI,OAAO,CAAC;EAClD;AACF;AAEA,SAASI,YAAYA,CAACQ,aAAqB,EAAEhB,OAA0B,EAAE;EAAA,IAAAiB,aAAA;EACvE,MAAMC,QAAQ,GAAG,CAAAlB,OAAO,aAAPA,OAAO,wBAAAiB,aAAA,GAAPjB,OAAO,CAAED,IAAI,cAAAkB,aAAA,uBAAbA,aAAA,CAAeE,iBAAiB,KAAI,CAAC,CAAC;EACvD,MAAMC,OAAO,GAAGJ,aAAa,IAAIE,QAAQ,IAAI,CAACA,QAAQ,CAACF,aAAa,CAAC;EACrE,OAAO,CAACI,OAAO;AACjB"}
|
|
@@ -11,7 +11,6 @@ const DEFAULT_GLTF_JSON = {
|
|
|
11
11
|
buffers: []
|
|
12
12
|
};
|
|
13
13
|
export default class GLTFScenegraph {
|
|
14
|
-
|
|
15
14
|
constructor(gltf) {
|
|
16
15
|
_defineProperty(this, "gltf", void 0);
|
|
17
16
|
_defineProperty(this, "sourceBuffers", void 0);
|
|
@@ -24,13 +23,11 @@ export default class GLTFScenegraph {
|
|
|
24
23
|
};
|
|
25
24
|
this.sourceBuffers = [];
|
|
26
25
|
this.byteLength = 0;
|
|
27
|
-
|
|
28
26
|
if (this.gltf.buffers && this.gltf.buffers[0]) {
|
|
29
27
|
this.byteLength = this.gltf.buffers[0].byteLength;
|
|
30
28
|
this.sourceBuffers = [this.gltf.buffers[0]];
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
get json() {
|
|
35
32
|
return this.gltf.json;
|
|
36
33
|
}
|
|
@@ -82,7 +79,6 @@ export default class GLTFScenegraph {
|
|
|
82
79
|
getAccessor(index) {
|
|
83
80
|
return this.getObject('accessors', index);
|
|
84
81
|
}
|
|
85
|
-
|
|
86
82
|
getTexture(index) {
|
|
87
83
|
return this.getObject('textures', index);
|
|
88
84
|
}
|
|
@@ -106,27 +102,21 @@ export default class GLTFScenegraph {
|
|
|
106
102
|
if (!object) {
|
|
107
103
|
throw new Error("glTF file error: Could not find ".concat(array, "[").concat(index, "]"));
|
|
108
104
|
}
|
|
109
|
-
|
|
110
105
|
return object;
|
|
111
106
|
}
|
|
112
|
-
|
|
113
107
|
getTypedArrayForBufferView(bufferView) {
|
|
114
108
|
bufferView = this.getBufferView(bufferView);
|
|
115
109
|
const bufferIndex = bufferView.buffer;
|
|
116
|
-
|
|
117
110
|
const binChunk = this.gltf.buffers[bufferIndex];
|
|
118
111
|
assert(binChunk);
|
|
119
|
-
|
|
120
112
|
const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
|
|
121
113
|
return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
|
|
122
114
|
}
|
|
123
|
-
|
|
124
115
|
getTypedArrayForAccessor(accessor) {
|
|
125
116
|
accessor = this.getAccessor(accessor);
|
|
126
117
|
const bufferView = this.getBufferView(accessor.bufferView);
|
|
127
118
|
const buffer = this.getBuffer(bufferView.buffer);
|
|
128
119
|
const arrayBuffer = buffer.data;
|
|
129
|
-
|
|
130
120
|
const {
|
|
131
121
|
ArrayType,
|
|
132
122
|
length
|
|
@@ -134,7 +124,6 @@ export default class GLTFScenegraph {
|
|
|
134
124
|
const byteOffset = bufferView.byteOffset + accessor.byteOffset;
|
|
135
125
|
return new ArrayType(arrayBuffer, byteOffset, length);
|
|
136
126
|
}
|
|
137
|
-
|
|
138
127
|
getTypedArrayForImageData(image) {
|
|
139
128
|
image = this.getAccessor(image);
|
|
140
129
|
const bufferView = this.getBufferView(image.bufferView);
|
|
@@ -143,12 +132,10 @@ export default class GLTFScenegraph {
|
|
|
143
132
|
const byteOffset = bufferView.byteOffset || 0;
|
|
144
133
|
return new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);
|
|
145
134
|
}
|
|
146
|
-
|
|
147
135
|
addApplicationData(key, data) {
|
|
148
136
|
this.json[key] = data;
|
|
149
137
|
return this;
|
|
150
138
|
}
|
|
151
|
-
|
|
152
139
|
addExtraData(key, data) {
|
|
153
140
|
this.json.extras = this.json.extras || {};
|
|
154
141
|
this.json.extras[key] = data;
|
|
@@ -164,14 +151,12 @@ export default class GLTFScenegraph {
|
|
|
164
151
|
const extensions = object.extensions || {};
|
|
165
152
|
extensions[extensionName] = data;
|
|
166
153
|
}
|
|
167
|
-
|
|
168
154
|
removeObjectExtension(object, extensionName) {
|
|
169
155
|
const extensions = object.extensions || {};
|
|
170
156
|
const extension = extensions[extensionName];
|
|
171
157
|
delete extensions[extensionName];
|
|
172
158
|
return extension;
|
|
173
159
|
}
|
|
174
|
-
|
|
175
160
|
addExtension(extensionName) {
|
|
176
161
|
let extensionData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
177
162
|
assert(extensionData);
|
|
@@ -180,7 +165,6 @@ export default class GLTFScenegraph {
|
|
|
180
165
|
this.registerUsedExtension(extensionName);
|
|
181
166
|
return extensionData;
|
|
182
167
|
}
|
|
183
|
-
|
|
184
168
|
addRequiredExtension(extensionName) {
|
|
185
169
|
let extensionData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
186
170
|
assert(extensionData);
|
|
@@ -188,14 +172,12 @@ export default class GLTFScenegraph {
|
|
|
188
172
|
this.registerRequiredExtension(extensionName);
|
|
189
173
|
return extensionData;
|
|
190
174
|
}
|
|
191
|
-
|
|
192
175
|
registerUsedExtension(extensionName) {
|
|
193
176
|
this.json.extensionsUsed = this.json.extensionsUsed || [];
|
|
194
177
|
if (!this.json.extensionsUsed.find(ext => ext === extensionName)) {
|
|
195
178
|
this.json.extensionsUsed.push(extensionName);
|
|
196
179
|
}
|
|
197
180
|
}
|
|
198
|
-
|
|
199
181
|
registerRequiredExtension(extensionName) {
|
|
200
182
|
this.registerUsedExtension(extensionName);
|
|
201
183
|
this.json.extensionsRequired = this.json.extensionsRequired || [];
|
|
@@ -203,7 +185,6 @@ export default class GLTFScenegraph {
|
|
|
203
185
|
this.json.extensionsRequired.push(extensionName);
|
|
204
186
|
}
|
|
205
187
|
}
|
|
206
|
-
|
|
207
188
|
removeExtension(extensionName) {
|
|
208
189
|
if (!this.getExtension(extensionName)) {
|
|
209
190
|
return;
|
|
@@ -225,11 +206,9 @@ export default class GLTFScenegraph {
|
|
|
225
206
|
extensionsRemoved.push(extensionName);
|
|
226
207
|
}
|
|
227
208
|
}
|
|
228
|
-
|
|
229
209
|
setDefaultScene(sceneIndex) {
|
|
230
210
|
this.json.scene = sceneIndex;
|
|
231
211
|
}
|
|
232
|
-
|
|
233
212
|
addScene(scene) {
|
|
234
213
|
const {
|
|
235
214
|
nodeIndices
|
|
@@ -240,7 +219,6 @@ export default class GLTFScenegraph {
|
|
|
240
219
|
});
|
|
241
220
|
return this.json.scenes.length - 1;
|
|
242
221
|
}
|
|
243
|
-
|
|
244
222
|
addNode(node) {
|
|
245
223
|
const {
|
|
246
224
|
meshIndex,
|
|
@@ -256,7 +234,6 @@ export default class GLTFScenegraph {
|
|
|
256
234
|
this.json.nodes.push(nodeData);
|
|
257
235
|
return this.json.nodes.length - 1;
|
|
258
236
|
}
|
|
259
|
-
|
|
260
237
|
addMesh(mesh) {
|
|
261
238
|
const {
|
|
262
239
|
attributes,
|
|
@@ -290,12 +267,10 @@ export default class GLTFScenegraph {
|
|
|
290
267
|
mode: 0
|
|
291
268
|
}]
|
|
292
269
|
};
|
|
293
|
-
|
|
294
270
|
this.json.meshes = this.json.meshes || [];
|
|
295
271
|
this.json.meshes.push(glTFMesh);
|
|
296
272
|
return this.json.meshes.length - 1;
|
|
297
273
|
}
|
|
298
|
-
|
|
299
274
|
addImage(imageData, mimeTypeOpt) {
|
|
300
275
|
const metadata = getBinaryImageMetadata(imageData);
|
|
301
276
|
const mimeType = mimeTypeOpt || (metadata === null || metadata === void 0 ? void 0 : metadata.mimeType);
|
|
@@ -308,11 +283,9 @@ export default class GLTFScenegraph {
|
|
|
308
283
|
this.json.images.push(glTFImage);
|
|
309
284
|
return this.json.images.length - 1;
|
|
310
285
|
}
|
|
311
|
-
|
|
312
286
|
addBufferView(buffer) {
|
|
313
287
|
const byteLength = buffer.byteLength;
|
|
314
288
|
assert(Number.isFinite(byteLength));
|
|
315
|
-
|
|
316
289
|
this.sourceBuffers = this.sourceBuffers || [];
|
|
317
290
|
this.sourceBuffers.push(buffer);
|
|
318
291
|
const glTFBufferView = {
|
|
@@ -320,14 +293,11 @@ export default class GLTFScenegraph {
|
|
|
320
293
|
byteOffset: this.byteLength,
|
|
321
294
|
byteLength
|
|
322
295
|
};
|
|
323
|
-
|
|
324
296
|
this.byteLength += padToNBytes(byteLength, 4);
|
|
325
|
-
|
|
326
297
|
this.json.bufferViews = this.json.bufferViews || [];
|
|
327
298
|
this.json.bufferViews.push(glTFBufferView);
|
|
328
299
|
return this.json.bufferViews.length - 1;
|
|
329
300
|
}
|
|
330
|
-
|
|
331
301
|
addAccessor(bufferViewIndex, accessor) {
|
|
332
302
|
const glTFAccessor = {
|
|
333
303
|
bufferView: bufferViewIndex,
|
|
@@ -341,7 +311,6 @@ export default class GLTFScenegraph {
|
|
|
341
311
|
this.json.accessors.push(glTFAccessor);
|
|
342
312
|
return this.json.accessors.length - 1;
|
|
343
313
|
}
|
|
344
|
-
|
|
345
314
|
addBinaryBuffer(sourceBuffer) {
|
|
346
315
|
let accessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
347
316
|
size: 3
|
|
@@ -363,7 +332,6 @@ export default class GLTFScenegraph {
|
|
|
363
332
|
};
|
|
364
333
|
return this.addAccessor(bufferViewIndex, Object.assign(accessorDefaults, accessor));
|
|
365
334
|
}
|
|
366
|
-
|
|
367
335
|
addTexture(texture) {
|
|
368
336
|
const {
|
|
369
337
|
imageIndex
|
|
@@ -375,26 +343,21 @@ export default class GLTFScenegraph {
|
|
|
375
343
|
this.json.textures.push(glTFTexture);
|
|
376
344
|
return this.json.textures.length - 1;
|
|
377
345
|
}
|
|
378
|
-
|
|
379
346
|
addMaterial(pbrMaterialInfo) {
|
|
380
347
|
this.json.materials = this.json.materials || [];
|
|
381
348
|
this.json.materials.push(pbrMaterialInfo);
|
|
382
349
|
return this.json.materials.length - 1;
|
|
383
350
|
}
|
|
384
|
-
|
|
385
351
|
createBinaryChunk() {
|
|
386
352
|
var _this$json, _this$json$buffers;
|
|
387
353
|
this.gltf.buffers = [];
|
|
388
|
-
|
|
389
354
|
const totalByteLength = this.byteLength;
|
|
390
355
|
const arrayBuffer = new ArrayBuffer(totalByteLength);
|
|
391
356
|
const targetArray = new Uint8Array(arrayBuffer);
|
|
392
|
-
|
|
393
357
|
let dstByteOffset = 0;
|
|
394
358
|
for (const sourceBuffer of this.sourceBuffers || []) {
|
|
395
359
|
dstByteOffset = copyToArray(sourceBuffer, targetArray, dstByteOffset);
|
|
396
360
|
}
|
|
397
|
-
|
|
398
361
|
if ((_this$json = this.json) !== null && _this$json !== void 0 && (_this$json$buffers = _this$json.buffers) !== null && _this$json$buffers !== void 0 && _this$json$buffers[0]) {
|
|
399
362
|
this.json.buffers[0].byteLength = totalByteLength;
|
|
400
363
|
} else {
|
|
@@ -402,12 +365,9 @@ export default class GLTFScenegraph {
|
|
|
402
365
|
byteLength: totalByteLength
|
|
403
366
|
}];
|
|
404
367
|
}
|
|
405
|
-
|
|
406
368
|
this.gltf.binary = arrayBuffer;
|
|
407
|
-
|
|
408
369
|
this.sourceBuffers = [arrayBuffer];
|
|
409
370
|
}
|
|
410
|
-
|
|
411
371
|
_removeStringFromArray(array, string) {
|
|
412
372
|
let found = true;
|
|
413
373
|
while (found) {
|
|
@@ -419,7 +379,6 @@ export default class GLTFScenegraph {
|
|
|
419
379
|
}
|
|
420
380
|
}
|
|
421
381
|
}
|
|
422
|
-
|
|
423
382
|
_addAttributes() {
|
|
424
383
|
let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
425
384
|
const result = {};
|
|
@@ -431,13 +390,11 @@ export default class GLTFScenegraph {
|
|
|
431
390
|
}
|
|
432
391
|
return result;
|
|
433
392
|
}
|
|
434
|
-
|
|
435
393
|
_addIndices(indices) {
|
|
436
394
|
return this.addBinaryBuffer(indices, {
|
|
437
395
|
size: 1
|
|
438
396
|
});
|
|
439
397
|
}
|
|
440
|
-
|
|
441
398
|
_getGltfAttributeName(attributeName) {
|
|
442
399
|
switch (attributeName.toLowerCase()) {
|
|
443
400
|
case 'position':
|
|
@@ -457,7 +414,6 @@ export default class GLTFScenegraph {
|
|
|
457
414
|
return attributeName;
|
|
458
415
|
}
|
|
459
416
|
}
|
|
460
|
-
|
|
461
417
|
_getAccessorMinMax(buffer, size) {
|
|
462
418
|
const result = {
|
|
463
419
|
min: null,
|
|
@@ -475,10 +431,8 @@ export default class GLTFScenegraph {
|
|
|
475
431
|
}
|
|
476
432
|
for (let index = size; index < buffer.length; index += size) {
|
|
477
433
|
for (let componentIndex = 0; componentIndex < size; componentIndex++) {
|
|
478
|
-
result.min[0 + componentIndex] = Math.min(
|
|
479
|
-
result.
|
|
480
|
-
result.max[0 + componentIndex] = Math.max(
|
|
481
|
-
result.max[0 + componentIndex], buffer[index + componentIndex]);
|
|
434
|
+
result.min[0 + componentIndex] = Math.min(result.min[0 + componentIndex], buffer[index + componentIndex]);
|
|
435
|
+
result.max[0 + componentIndex] = Math.max(result.max[0 + componentIndex], buffer[index + componentIndex]);
|
|
482
436
|
}
|
|
483
437
|
}
|
|
484
438
|
return result;
|