@loaders.gl/tile-converter 3.3.3 → 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 CHANGED
@@ -67658,6 +67658,9 @@ var Tile3D = class {
67658
67658
  unselect() {
67659
67659
  this._selectedFrame = 0;
67660
67660
  }
67661
+ _getGpuMemoryUsageInBytes() {
67662
+ return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;
67663
+ }
67661
67664
  _getPriority() {
67662
67665
  const traverser = this.tileset._traverser;
67663
67666
  const { skipLevelOfDetail } = traverser.options;
@@ -67857,6 +67860,8 @@ var Tile3D = class {
67857
67860
  }
67858
67861
  if (this._isTileset()) {
67859
67862
  this.hasTilesetContent = true;
67863
+ } else {
67864
+ this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();
67860
67865
  }
67861
67866
  }
67862
67867
  _updateBoundingVolume(header) {
@@ -68200,7 +68205,7 @@ var Tileset3D = class {
68200
68205
  }
68201
68206
  get queryParams() {
68202
68207
  if (!this._queryParamsString) {
68203
- this._queryParamsString = getQueryParamString(this._queryParams);
68208
+ this._queryParamsString = new URLSearchParams(this._queryParams).toString();
68204
68209
  }
68205
68210
  return this._queryParamsString;
68206
68211
  }
@@ -68215,7 +68220,7 @@ var Tileset3D = class {
68215
68220
  if (isDataUrl) {
68216
68221
  return tilePath;
68217
68222
  }
68218
- return `${tilePath}${this.queryParams}`;
68223
+ return `${tilePath}${tilePath.includes("?") ? "&" : "?"}${this.queryParams}`;
68219
68224
  }
68220
68225
  hasExtension(extensionName) {
68221
68226
  return Boolean(this._extensionsUsed && this._extensionsUsed.indexOf(extensionName) > -1);
@@ -68448,6 +68453,10 @@ var Tileset3D = class {
68448
68453
  const children = tile.header.children || [];
68449
68454
  for (const childHeader of children) {
68450
68455
  const childTile = new Tile3D(this, childHeader, tile);
68456
+ if (childTile.contentUrl?.includes("?session=")) {
68457
+ const url = new URL(childTile.contentUrl);
68458
+ this._queryParams.session = url.searchParams.get("session");
68459
+ }
68451
68460
  tile.children.push(childTile);
68452
68461
  childTile.depth = tile.depth + 1;
68453
68462
  stack2.push(childTile);
@@ -68553,11 +68562,11 @@ var Tileset3D = class {
68553
68562
  _updateCacheStats(tile) {
68554
68563
  this.stats.get(TILES_LOADED).incrementCount();
68555
68564
  this.stats.get(TILES_IN_MEMORY).incrementCount();
68556
- this.gpuMemoryUsageInBytes += tile.content.byteLength || 0;
68565
+ this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
68557
68566
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
68558
68567
  }
68559
68568
  _unloadTile(tile) {
68560
- this.gpuMemoryUsageInBytes -= tile.content && tile.content.byteLength || 0;
68569
+ this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
68561
68570
  this.stats.get(TILES_IN_MEMORY).decrementCount();
68562
68571
  this.stats.get(TILES_UNLOADED).incrementCount();
68563
68572
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
@@ -68624,20 +68633,6 @@ var Tileset3D = class {
68624
68633
  }
68625
68634
  }
68626
68635
  };
68627
- function getQueryParamString(queryParams) {
68628
- const queryParamStrings = [];
68629
- for (const key of Object.keys(queryParams)) {
68630
- queryParamStrings.push(`${key}=${queryParams[key]}`);
68631
- }
68632
- switch (queryParamStrings.length) {
68633
- case 0:
68634
- return "";
68635
- case 1:
68636
- return `?${queryParamStrings[0]}`;
68637
- default:
68638
- return `?${queryParamStrings.join("&")}`;
68639
- }
68640
- }
68641
68636
 
68642
68637
  // ../3d-tiles/src/lib/utils/version.ts
68643
68638
  var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -72196,6 +72191,19 @@ function getAccessorArrayTypeAndLength(accessor, bufferView) {
72196
72191
  assert6(byteLength >= 0 && byteLength <= bufferView.byteLength);
72197
72192
  return { ArrayType, length, byteLength };
72198
72193
  }
72194
+ function getMemoryUsageGLTF(gltf) {
72195
+ let { images, bufferViews } = gltf;
72196
+ images = images || [];
72197
+ bufferViews = bufferViews || [];
72198
+ const imageBufferViews = images.map((i) => i.bufferView);
72199
+ bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view));
72200
+ const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);
72201
+ const pixelCount = images.reduce((acc, image) => {
72202
+ const { width, height } = image.image;
72203
+ return acc + width * height;
72204
+ }, 0);
72205
+ return bufferMemory + Math.ceil(4 * pixelCount * 1.33);
72206
+ }
72199
72207
 
72200
72208
  // ../gltf/src/lib/api/gltf-scenegraph.ts
72201
72209
  var DEFAULT_GLTF_JSON = {
@@ -74281,6 +74289,7 @@ async function extractGLTF(tile, gltfFormat, options, context) {
74281
74289
  }
74282
74290
  if (tile.gltfArrayBuffer) {
74283
74291
  tile.gltf = await parse9(tile.gltfArrayBuffer, GLTFLoader, options, context);
74292
+ tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
74284
74293
  delete tile.gltfArrayBuffer;
74285
74294
  delete tile.gltfByteOffset;
74286
74295
  delete tile.gltfByteLength;
@@ -74488,6 +74497,7 @@ async function parseGltf3DTile(tile, arrayBuffer, options, context) {
74488
74497
  tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
74489
74498
  const { parse: parse9 } = context;
74490
74499
  tile.gltf = await parse9(arrayBuffer, GLTFLoader, options, context);
74500
+ tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
74491
74501
  }
74492
74502
 
74493
74503
  // ../3d-tiles/src/lib/parsers/parse-3d-tile.ts
@@ -74772,7 +74782,7 @@ function getTileType(tile) {
74772
74782
  if (!tile.contentUrl) {
74773
74783
  return TILE_TYPE.EMPTY;
74774
74784
  }
74775
- const contentUrl = tile.contentUrl;
74785
+ const contentUrl = tile.contentUrl.split("?")[0];
74776
74786
  const fileExtension = contentUrl.split(".").pop();
74777
74787
  switch (fileExtension) {
74778
74788
  case "pnts":
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports._typecheckI3SAttributesWorker = exports.Tile3dAttributesWorker = void 0;
7
7
  exports.transform3DTilesAttributesOnWorker = transform3DTilesAttributesOnWorker;
8
8
  var _workerUtils = require("@loaders.gl/worker-utils");
9
- var VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'latest';
9
+ var VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
10
10
  var Tile3dAttributesWorker = {
11
11
  id: '3d-tiles-attributes',
12
12
  name: '3DTiles Attributes Worker',
@@ -14,7 +14,7 @@ var _zip = require("@loaders.gl/zip");
14
14
  var _fileUtils = require("../lib/utils/file-utils");
15
15
  var _path = require("path");
16
16
  var _workerUtils = require("@loaders.gl/worker-utils");
17
- var VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'beta';
17
+ var VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'beta';
18
18
  var PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
19
19
 
20
20
  var DepsInstaller = function () {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports._typecheckI3SAttributesWorker = exports.I3SAttributesWorker = void 0;
7
7
  exports.transformI3SAttributesOnWorker = transformI3SAttributesOnWorker;
8
8
  var _workerUtils = require("@loaders.gl/worker-utils");
9
- var VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'latest';
9
+ var VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
10
10
  var I3SAttributesWorker = {
11
11
  id: 'i3s-attributes',
12
12
  name: 'I3S Attributes Worker',
@@ -8,7 +8,7 @@ exports.PGMLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _geoid = require("@math.gl/geoid");
11
- var VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'latest';
11
+ var VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
12
12
 
13
13
  var PGMLoader = {
14
14
  name: 'PGM - Netpbm grayscale image format',
@@ -1,6 +1,6 @@
1
1
  import { processOnWorker } from '@loaders.gl/worker-utils';
2
2
 
3
- const VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'latest';
3
+ const VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
4
4
  export const Tile3dAttributesWorker = {
5
5
  id: '3d-tiles-attributes',
6
6
  name: '3DTiles Attributes Worker',
@@ -4,7 +4,7 @@ import { writeFile } from '../lib/utils/file-utils';
4
4
  import { join } from 'path';
5
5
  import { ChildProcessProxy } from '@loaders.gl/worker-utils';
6
6
 
7
- const VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'beta';
7
+ const VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'beta';
8
8
  const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
9
9
 
10
10
  export class DepsInstaller {
@@ -1,6 +1,6 @@
1
1
  import { processOnWorker } from '@loaders.gl/worker-utils';
2
2
 
3
- const VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'latest';
3
+ const VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
4
4
  export const I3SAttributesWorker = {
5
5
  id: 'i3s-attributes',
6
6
  name: 'I3S Attributes Worker',
@@ -1,6 +1,6 @@
1
1
  import { parsePGM } from '@math.gl/geoid';
2
2
 
3
- const VERSION = typeof "3.3.3" !== 'undefined' ? "3.3.3" : 'latest';
3
+ const VERSION = typeof "3.3.5" !== 'undefined' ? "3.3.5" : 'latest';
4
4
 
5
5
  export const PGMLoader = {
6
6
  name: 'PGM - Netpbm grayscale image format',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -44,19 +44,19 @@
44
44
  "build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/3d-tiles": "3.3.3",
48
- "@loaders.gl/crypto": "3.3.3",
49
- "@loaders.gl/draco": "3.3.3",
50
- "@loaders.gl/gltf": "3.3.3",
51
- "@loaders.gl/i3s": "3.3.3",
52
- "@loaders.gl/images": "3.3.3",
53
- "@loaders.gl/loader-utils": "3.3.3",
54
- "@loaders.gl/polyfills": "3.3.3",
55
- "@loaders.gl/schema": "3.3.3",
56
- "@loaders.gl/textures": "3.3.3",
57
- "@loaders.gl/tiles": "3.3.3",
58
- "@loaders.gl/worker-utils": "3.3.3",
59
- "@loaders.gl/zip": "3.3.3",
47
+ "@loaders.gl/3d-tiles": "3.3.5",
48
+ "@loaders.gl/crypto": "3.3.5",
49
+ "@loaders.gl/draco": "3.3.5",
50
+ "@loaders.gl/gltf": "3.3.5",
51
+ "@loaders.gl/i3s": "3.3.5",
52
+ "@loaders.gl/images": "3.3.5",
53
+ "@loaders.gl/loader-utils": "3.3.5",
54
+ "@loaders.gl/polyfills": "3.3.5",
55
+ "@loaders.gl/schema": "3.3.5",
56
+ "@loaders.gl/textures": "3.3.5",
57
+ "@loaders.gl/tiles": "3.3.5",
58
+ "@loaders.gl/worker-utils": "3.3.5",
59
+ "@loaders.gl/zip": "3.3.5",
60
60
  "@luma.gl/engine": "^8.5.4",
61
61
  "@math.gl/core": "^3.5.1",
62
62
  "@math.gl/culling": "^3.5.1",
@@ -80,5 +80,5 @@
80
80
  "join-images": "^1.1.3",
81
81
  "sharp": "^0.31.3"
82
82
  },
83
- "gitHead": "44f4e272d8216f226a332eaae81e832e44c7e474"
83
+ "gitHead": "8aaa7fea4b7d72536d9d1f7d79688ec6702b2904"
84
84
  }