@loaders.gl/3d-tiles 3.3.4 → 3.3.5
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 +16 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +4 -3
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +2 -1
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +2 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +2 -1
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +1 -0
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.js +1 -0
- package/package.json +7 -7
- package/src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts +2 -1
- package/src/lib/parsers/parse-3d-tile-gltf.ts +2 -1
package/dist/dist.min.js
CHANGED
|
@@ -9378,6 +9378,19 @@
|
|
|
9378
9378
|
assert8(byteLength >= 0 && byteLength <= bufferView.byteLength);
|
|
9379
9379
|
return { ArrayType, length: length4, byteLength };
|
|
9380
9380
|
}
|
|
9381
|
+
function getMemoryUsageGLTF(gltf) {
|
|
9382
|
+
let { images, bufferViews } = gltf;
|
|
9383
|
+
images = images || [];
|
|
9384
|
+
bufferViews = bufferViews || [];
|
|
9385
|
+
const imageBufferViews = images.map((i2) => i2.bufferView);
|
|
9386
|
+
bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view));
|
|
9387
|
+
const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);
|
|
9388
|
+
const pixelCount = images.reduce((acc, image) => {
|
|
9389
|
+
const { width, height } = image.image;
|
|
9390
|
+
return acc + width * height;
|
|
9391
|
+
}, 0);
|
|
9392
|
+
return bufferMemory + Math.ceil(4 * pixelCount * 1.33);
|
|
9393
|
+
}
|
|
9381
9394
|
var TYPES, ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT, ARRAY_TO_COMPONENT_TYPE, ATTRIBUTE_TYPE_TO_COMPONENTS, ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE, ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY;
|
|
9382
9395
|
var init_gltf_utils = __esm({
|
|
9383
9396
|
"../gltf/src/lib/gltf-utils/gltf-utils.ts"() {
|
|
@@ -11623,6 +11636,7 @@
|
|
|
11623
11636
|
var init_src10 = __esm({
|
|
11624
11637
|
"../gltf/src/index.ts"() {
|
|
11625
11638
|
init_gltf_loader();
|
|
11639
|
+
init_gltf_utils();
|
|
11626
11640
|
}
|
|
11627
11641
|
});
|
|
11628
11642
|
|
|
@@ -11654,6 +11668,7 @@
|
|
|
11654
11668
|
}
|
|
11655
11669
|
if (tile.gltfArrayBuffer) {
|
|
11656
11670
|
tile.gltf = await parse5(tile.gltfArrayBuffer, GLTFLoader, options, context);
|
|
11671
|
+
tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
|
|
11657
11672
|
delete tile.gltfArrayBuffer;
|
|
11658
11673
|
delete tile.gltfByteOffset;
|
|
11659
11674
|
delete tile.gltfByteLength;
|
|
@@ -11896,6 +11911,7 @@
|
|
|
11896
11911
|
tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
|
|
11897
11912
|
const { parse: parse5 } = context;
|
|
11898
11913
|
tile.gltf = await parse5(arrayBuffer, GLTFLoader, options, context);
|
|
11914
|
+
tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
|
|
11899
11915
|
}
|
|
11900
11916
|
var init_parse_3d_tile_gltf = __esm({
|
|
11901
11917
|
"src/lib/parsers/parse-3d-tile-gltf.ts"() {
|
|
@@ -50,7 +50,7 @@ function _extractGLTF() {
|
|
|
50
50
|
tile3DOptions = options['3d-tiles'] || {};
|
|
51
51
|
extractGLTFBufferOrURL(tile, gltfFormat, options);
|
|
52
52
|
if (!tile3DOptions.loadGLTF) {
|
|
53
|
-
_context.next =
|
|
53
|
+
_context.next = 17;
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
parse = context.parse, fetch = context.fetch;
|
|
@@ -65,17 +65,18 @@ function _extractGLTF() {
|
|
|
65
65
|
tile.gltfByteOffset = 0;
|
|
66
66
|
case 9:
|
|
67
67
|
if (!tile.gltfArrayBuffer) {
|
|
68
|
-
_context.next =
|
|
68
|
+
_context.next = 17;
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
_context.next = 12;
|
|
72
72
|
return parse(tile.gltfArrayBuffer, _gltf.GLTFLoader, options, context);
|
|
73
73
|
case 12:
|
|
74
74
|
tile.gltf = _context.sent;
|
|
75
|
+
tile.gpuMemoryUsageInBytes = (0, _gltf._getMemoryUsageGLTF)(tile.gltf);
|
|
75
76
|
delete tile.gltfArrayBuffer;
|
|
76
77
|
delete tile.gltfByteOffset;
|
|
77
78
|
delete tile.gltfByteLength;
|
|
78
|
-
case
|
|
79
|
+
case 17:
|
|
79
80
|
case "end":
|
|
80
81
|
return _context.stop();
|
|
81
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","sliceArrayBuffer","gltfByteOffset","console","warn","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","GLTFLoader","gltf","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\n\nimport {GLTFLoader} from '@loaders.gl/gltf';\nimport {sliceArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\n\nexport function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n\n // Assume glTF consumes rest of tile\n const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n } else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n\n // Entire tile is consumed\n return tile.byteOffset + tile.byteLength;\n}\n\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n tile.gltfArrayBuffer = await fetch(tile.gltfUrl, options);\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n tile.gltf = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\n\nfunction extractGLTFBufferOrURL(tile, gltfFormat, options) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n"],"mappings":";;;;;;;;;;;AASA;AACA;;AAEO,IAAMA,WAAW,GAAG;EACzBC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE;AACZ,CAAC;AAAC;AAEK,SAASC,uBAAuB,CAACC,IAAI,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAE;EAI9EH,IAAI,CAACI,UAAU,GAAG,IAAI;;EAGtB,IAAMC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,CAACU,eAAe;YACpBV,IAAI,CAACY,cAAc,GAAG,CAAC;UAAC;YAAA,KAEtBZ,IAAI,CAACU,eAAe;cAAA;cAAA;YAAA;YAAA;YAAA,OAEJY,KAAK,CAACtB,IAAI,CAACU,eAAe,EAAEe,gBAAU,EAAEtB,OAAO,EAAEe,OAAO,CAAC;UAAA;YAA3ElB,IAAI,CAAC0B,IAAI;
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","sliceArrayBuffer","gltfByteOffset","console","warn","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","GLTFLoader","gltf","gpuMemoryUsageInBytes","_getMemoryUsageGLTF","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\n\nimport {_getMemoryUsageGLTF, GLTFLoader} from '@loaders.gl/gltf';\nimport {sliceArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\n\nexport function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n\n // Assume glTF consumes rest of tile\n const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n } else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n\n // Entire tile is consumed\n return tile.byteOffset + tile.byteLength;\n}\n\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n tile.gltfArrayBuffer = await fetch(tile.gltfUrl, options);\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n tile.gltf = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\n\nfunction extractGLTFBufferOrURL(tile, gltfFormat, options) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n"],"mappings":";;;;;;;;;;;AASA;AACA;;AAEO,IAAMA,WAAW,GAAG;EACzBC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE;AACZ,CAAC;AAAC;AAEK,SAASC,uBAAuB,CAACC,IAAI,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAE;EAI9EH,IAAI,CAACI,UAAU,GAAG,IAAI;;EAGtB,IAAMC,cAAc,GAAGL,IAAI,CAACE,UAAU,GAAGF,IAAI,CAACM,UAAU,GAAGJ,UAAU;EACrE,IAAIG,cAAc,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIE,KAAK,CAAC,0CAA0C,CAAC;EAC7D;;EAGAP,IAAI,CAACQ,UAAU,GACbL,OAAO,CAAC,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACtDN,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACnC,GAAG;;EAITT,IAAI,CAACU,eAAe,GAAG,IAAAC,6BAAgB,EAACV,WAAW,EAAEC,UAAU,EAAEG,cAAc,CAAC;EAChFL,IAAI,CAACY,cAAc,GAAG,CAAC;EACvBZ,IAAI,CAACK,cAAc,GAAGA,cAAc;EAEpC,IAAIH,UAAU,GAAG,CAAC,KAAK,CAAC,EAAE;EAI1B,CAAC,MAAM;IAGLW,OAAO,CAACC,IAAI,WAAId,IAAI,CAACe,IAAI,yDAAsD;EACjF;;EAGA,OAAOf,IAAI,CAACE,UAAU,GAAGF,IAAI,CAACM,UAAU;AA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V,IAAI,CAACY,cAAc,CAAC;MAC9E,IAAMmB,WAAW,GAAG,IAAIC,WAAW,EAAE;MACrC,IAAMR,OAAO,GAAGO,WAAW,CAACE,MAAM,CAACJ,YAAY,CAAC;MAChD7B,IAAI,CAACwB,OAAO,GAAGA,OAAO,CAACU,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;MAC9C,OAAOlC,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACY,cAAc;MAC1B,OAAOZ,IAAI,CAACK,cAAc;MAC1B;IACF,KAAKT,WAAW,CAACE,QAAQ;MACvB;IACF;MACE,MAAM,IAAIS,KAAK,CAAC,iCAAiC,CAAC;EAAC;AAEzD"}
|
|
@@ -25,7 +25,8 @@ function _parseGltf3DTile() {
|
|
|
25
25
|
return parse(arrayBuffer, _gltf.GLTFLoader, options, context);
|
|
26
26
|
case 5:
|
|
27
27
|
tile.gltf = _context.sent;
|
|
28
|
-
|
|
28
|
+
tile.gpuMemoryUsageInBytes = (0, _gltf._getMemoryUsageGLTF)(tile.gltf);
|
|
29
|
+
case 7:
|
|
29
30
|
case "end":
|
|
30
31
|
return _context.stop();
|
|
31
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf.js","names":["parseGltf3DTile","tile","arrayBuffer","options","context","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","parse","GLTFLoader","gltf"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import {GLTFLoader} from '@loaders.gl/gltf';\n\nexport async function parseGltf3DTile(tile, arrayBuffer, options, context) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n const {parse} = context;\n tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);\n}\n"],"mappings":";;;;;;;;;AAAA;
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf.js","names":["parseGltf3DTile","tile","arrayBuffer","options","context","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","parse","GLTFLoader","gltf","gpuMemoryUsageInBytes","_getMemoryUsageGLTF"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import {_getMemoryUsageGLTF, GLTFLoader} from '@loaders.gl/gltf';\n\nexport async function parseGltf3DTile(tile, arrayBuffer, options, context) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n const {parse} = context;\n tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n}\n"],"mappings":";;;;;;;;;AAAA;AAAiE,SAE3CA,eAAe;EAAA;AAAA;AAAA;EAAA,6EAA9B,iBAA+BC,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,OAAO;IAAA;IAAA;MAAA;QAAA;UAAA;YAIvEH,IAAI,CAACI,UAAU,GAAG,IAAI;YAEtBJ,IAAI,CAACK,UAAU,GACbH,OAAO,CAAC,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACI,eAAe,GACtDJ,OAAO,CAAC,UAAU,CAAC,CAACI,eAAe,GACnC,GAAG;YAEFC,KAAK,GAAIJ,OAAO,CAAhBI,KAAK;YAAA;YAAA,OACMA,KAAK,CAACN,WAAW,EAAEO,gBAAU,EAAEN,OAAO,EAAEC,OAAO,CAAC;UAAA;YAAlEH,IAAI,CAACS,IAAI;YACTT,IAAI,CAACU,qBAAqB,GAAG,IAAAC,yBAAmB,EAACX,IAAI,CAACS,IAAI,CAAC;UAAC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAC7D;EAAA;AAAA"}
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = void 0;
|
|
7
|
-
var VERSION = typeof "3.3.
|
|
7
|
+
var VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { GLTFLoader } from '@loaders.gl/gltf';
|
|
3
|
+
import { _getMemoryUsageGLTF, GLTFLoader } from '@loaders.gl/gltf';
|
|
4
4
|
import { sliceArrayBuffer } from '@loaders.gl/loader-utils';
|
|
5
5
|
export const GLTF_FORMAT = {
|
|
6
6
|
URI: 0,
|
|
@@ -40,6 +40,7 @@ export async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
40
40
|
}
|
|
41
41
|
if (tile.gltfArrayBuffer) {
|
|
42
42
|
tile.gltf = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);
|
|
43
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
43
44
|
delete tile.gltfArrayBuffer;
|
|
44
45
|
delete tile.gltfByteOffset;
|
|
45
46
|
delete tile.gltfByteLength;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTFLoader","sliceArrayBuffer","GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","gltfByteOffset","console","warn","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","gltf","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\n\nimport {GLTFLoader} from '@loaders.gl/gltf';\nimport {sliceArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\n\nexport function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n\n // Assume glTF consumes rest of tile\n const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n } else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n\n // Entire tile is consumed\n return tile.byteOffset + tile.byteLength;\n}\n\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n tile.gltfArrayBuffer = await fetch(tile.gltfUrl, options);\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n tile.gltf = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\n\nfunction extractGLTFBufferOrURL(tile, gltfFormat, options) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n"],"mappings":";;AASA,SAAQA,UAAU,QAAO,kBAAkB;
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf-view.js","names":["_getMemoryUsageGLTF","GLTFLoader","sliceArrayBuffer","GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","gltfByteOffset","console","warn","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","gltf","gpuMemoryUsageInBytes","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\n\nimport {_getMemoryUsageGLTF, GLTFLoader} from '@loaders.gl/gltf';\nimport {sliceArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\n\nexport function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n\n // Assume glTF consumes rest of tile\n const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n } else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n\n // Entire tile is consumed\n return tile.byteOffset + tile.byteLength;\n}\n\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n tile.gltfArrayBuffer = await fetch(tile.gltfUrl, options);\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n tile.gltf = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\n\nfunction extractGLTFBufferOrURL(tile, gltfFormat, options) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n"],"mappings":";;AASA,SAAQA,mBAAmB,EAAEC,UAAU,QAAO,kBAAkB;AAChE,SAAQC,gBAAgB,QAAO,0BAA0B;AAEzD,OAAO,MAAMC,WAAW,GAAG;EACzBC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,uB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,OAAO,CAAC;MACzDH,IAAI,CAACW,cAAc,GAAG,CAAC;IACzB;IACA,IAAIX,IAAI,CAACU,eAAe,EAAE;MAExBV,IAAI,CAACwB,IAAI,GAAG,MAAMH,KAAK,CAACrB,IAAI,CAACU,eAAe,EAAEhB,UAAU,EAAES,OAAO,EAAEc,OAAO,CAAC;MAC3EjB,IAAI,CAACyB,qBAAqB,GAAGhC,mBAAmB,CAACO,IAAI,CAACwB,IAAI,CAAC;MAC3D,OAAOxB,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACW,cAAc;MAC1B,OAAOX,IAAI,CAACK,cAAc;IAC5B;EACF;AACF;AAEA,SAASc,sBAAsB,CAACnB,IAAI,EAAEgB,UAAU,EAAEb,OAAO,EAAE;EACzD,QAAQa,UAAU;IAChB,KAAKpB,WAAW,CAACC,GAAG;MAGlB,MAAM6B,YAAY,GAAG,IAAIC,UAAU,CAAC3B,IAAI,CAACU,eAAe,EAAEV,IAAI,CAACW,cAAc,CAAC;MAC9E,MAAMiB,WAAW,GAAG,IAAIC,WAAW,EAAE;MACrC,MAAMN,OAAO,GAAGK,WAAW,CAACE,MAAM,CAACJ,YAAY,CAAC;MAChD1B,IAAI,CAACuB,OAAO,GAAGA,OAAO,CAACQ,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;MAC9C,OAAO/B,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACW,cAAc;MAC1B,OAAOX,IAAI,CAACK,cAAc;MAC1B;IACF,KAAKT,WAAW,CAACE,QAAQ;MACvB;IACF;MACE,MAAM,IAAIS,KAAK,CAAC,iCAAiC,CAAC;EAAC;AAEzD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GLTFLoader } from '@loaders.gl/gltf';
|
|
1
|
+
import { _getMemoryUsageGLTF, GLTFLoader } from '@loaders.gl/gltf';
|
|
2
2
|
export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
3
3
|
tile.rotateYtoZ = true;
|
|
4
4
|
tile.gltfUpAxis = options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis ? options['3d-tiles'].assetGltfUpAxis : 'Y';
|
|
@@ -6,5 +6,6 @@ export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
|
6
6
|
parse
|
|
7
7
|
} = context;
|
|
8
8
|
tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);
|
|
9
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=parse-3d-tile-gltf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf.js","names":["GLTFLoader","parseGltf3DTile","tile","arrayBuffer","options","context","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","parse","gltf"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import {GLTFLoader} from '@loaders.gl/gltf';\n\nexport async function parseGltf3DTile(tile, arrayBuffer, options, context) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n const {parse} = context;\n tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);\n}\n"],"mappings":"AAAA,SAAQA,UAAU,QAAO,kBAAkB;
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf.js","names":["_getMemoryUsageGLTF","GLTFLoader","parseGltf3DTile","tile","arrayBuffer","options","context","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","parse","gltf","gpuMemoryUsageInBytes"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import {_getMemoryUsageGLTF, GLTFLoader} from '@loaders.gl/gltf';\n\nexport async function parseGltf3DTile(tile, arrayBuffer, options, context) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n const {parse} = context;\n tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n}\n"],"mappings":"AAAA,SAAQA,mBAAmB,EAAEC,UAAU,QAAO,kBAAkB;AAEhE,OAAO,eAAeC,eAAe,CAACC,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,OAAO,EAAE;EAIzEH,IAAI,CAACI,UAAU,GAAG,IAAI;EAEtBJ,IAAI,CAACK,UAAU,GACbH,OAAO,CAAC,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACI,eAAe,GACtDJ,OAAO,CAAC,UAAU,CAAC,CAACI,eAAe,GACnC,GAAG;EAET,MAAM;IAACC;EAAK,CAAC,GAAGJ,OAAO;EACvBH,IAAI,CAACQ,IAAI,GAAG,MAAMD,KAAK,CAACN,WAAW,EAAEH,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;EAClEH,IAAI,CAACS,qBAAqB,GAAGZ,mBAAmB,CAACG,IAAI,CAACQ,IAAI,CAAC;AAC7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf-view.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,IAAI,KAAA,EAAE,WAAW,KAAA,EAAE,UAAU,KAAA,EAAE,OAAO,KAAA,OAoC7E;AAED,wBAAsB,WAAW,CAAC,IAAI,KAAA,EAAE,UAAU,KAAA,EAAE,OAAO,KAAA,EAAE,OAAO,KAAA,
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf-view.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,IAAI,KAAA,EAAE,WAAW,KAAA,EAAE,UAAU,KAAA,EAAE,OAAO,KAAA,OAoC7E;AAED,wBAAsB,WAAW,CAAC,IAAI,KAAA,EAAE,UAAU,KAAA,EAAE,OAAO,KAAA,EAAE,OAAO,KAAA,iBAoBnE"}
|
|
@@ -60,6 +60,7 @@ async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
60
60
|
if (tile.gltfArrayBuffer) {
|
|
61
61
|
// TODO - Should handle byteOffset... However, not used now...
|
|
62
62
|
tile.gltf = await parse(tile.gltfArrayBuffer, gltf_1.GLTFLoader, options, context);
|
|
63
|
+
tile.gpuMemoryUsageInBytes = (0, gltf_1._getMemoryUsageGLTF)(tile.gltf);
|
|
63
64
|
delete tile.gltfArrayBuffer;
|
|
64
65
|
delete tile.gltfByteOffset;
|
|
65
66
|
delete tile.gltfByteLength;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,IAAI,KAAA,EAAE,WAAW,KAAA,EAAE,OAAO,KAAA,EAAE,OAAO,KAAA,
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,IAAI,KAAA,EAAE,WAAW,KAAA,EAAE,OAAO,KAAA,EAAE,OAAO,KAAA,iBAcxE"}
|
|
@@ -14,5 +14,6 @@ async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
|
14
14
|
: 'Y';
|
|
15
15
|
const { parse } = context;
|
|
16
16
|
tile.gltf = await parse(arrayBuffer, gltf_1.GLTFLoader, options, context);
|
|
17
|
+
tile.gpuMemoryUsageInBytes = (0, gltf_1._getMemoryUsageGLTF)(tile.gltf);
|
|
17
18
|
}
|
|
18
19
|
exports.parseGltf3DTile = parseGltf3DTile;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/3d-tiles",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@loaders.gl/draco": "3.3.
|
|
38
|
-
"@loaders.gl/gltf": "3.3.
|
|
39
|
-
"@loaders.gl/loader-utils": "3.3.
|
|
40
|
-
"@loaders.gl/math": "3.3.
|
|
41
|
-
"@loaders.gl/tiles": "3.3.
|
|
37
|
+
"@loaders.gl/draco": "3.3.5",
|
|
38
|
+
"@loaders.gl/gltf": "3.3.5",
|
|
39
|
+
"@loaders.gl/loader-utils": "3.3.5",
|
|
40
|
+
"@loaders.gl/math": "3.3.5",
|
|
41
|
+
"@loaders.gl/tiles": "3.3.5",
|
|
42
42
|
"@math.gl/core": "^3.5.1",
|
|
43
43
|
"@math.gl/geospatial": "^3.5.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@loaders.gl/core": "^3.2.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "8aaa7fea4b7d72536d9d1f7d79688ec6702b2904"
|
|
49
49
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// - Do we add an option to control this?
|
|
8
8
|
// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?
|
|
9
9
|
|
|
10
|
-
import {GLTFLoader} from '@loaders.gl/gltf';
|
|
10
|
+
import {_getMemoryUsageGLTF, GLTFLoader} from '@loaders.gl/gltf';
|
|
11
11
|
import {sliceArrayBuffer} from '@loaders.gl/loader-utils';
|
|
12
12
|
|
|
13
13
|
export const GLTF_FORMAT = {
|
|
@@ -67,6 +67,7 @@ export async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
67
67
|
if (tile.gltfArrayBuffer) {
|
|
68
68
|
// TODO - Should handle byteOffset... However, not used now...
|
|
69
69
|
tile.gltf = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);
|
|
70
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
70
71
|
delete tile.gltfArrayBuffer;
|
|
71
72
|
delete tile.gltfByteOffset;
|
|
72
73
|
delete tile.gltfByteLength;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {GLTFLoader} from '@loaders.gl/gltf';
|
|
1
|
+
import {_getMemoryUsageGLTF, GLTFLoader} from '@loaders.gl/gltf';
|
|
2
2
|
|
|
3
3
|
export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
4
4
|
// Set flags
|
|
@@ -13,4 +13,5 @@ export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
|
13
13
|
|
|
14
14
|
const {parse} = context;
|
|
15
15
|
tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);
|
|
16
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
16
17
|
}
|