@loaders.gl/tile-converter 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 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) {
@@ -68557,11 +68562,11 @@ var Tileset3D = class {
68557
68562
  _updateCacheStats(tile) {
68558
68563
  this.stats.get(TILES_LOADED).incrementCount();
68559
68564
  this.stats.get(TILES_IN_MEMORY).incrementCount();
68560
- this.gpuMemoryUsageInBytes += tile.content.byteLength || 0;
68565
+ this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
68561
68566
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
68562
68567
  }
68563
68568
  _unloadTile(tile) {
68564
- this.gpuMemoryUsageInBytes -= tile.content && tile.content.byteLength || 0;
68569
+ this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
68565
68570
  this.stats.get(TILES_IN_MEMORY).decrementCount();
68566
68571
  this.stats.get(TILES_UNLOADED).incrementCount();
68567
68572
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
@@ -72186,6 +72191,19 @@ function getAccessorArrayTypeAndLength(accessor, bufferView) {
72186
72191
  assert6(byteLength >= 0 && byteLength <= bufferView.byteLength);
72187
72192
  return { ArrayType, length, byteLength };
72188
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
+ }
72189
72207
 
72190
72208
  // ../gltf/src/lib/api/gltf-scenegraph.ts
72191
72209
  var DEFAULT_GLTF_JSON = {
@@ -74271,6 +74289,7 @@ async function extractGLTF(tile, gltfFormat, options, context) {
74271
74289
  }
74272
74290
  if (tile.gltfArrayBuffer) {
74273
74291
  tile.gltf = await parse9(tile.gltfArrayBuffer, GLTFLoader, options, context);
74292
+ tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
74274
74293
  delete tile.gltfArrayBuffer;
74275
74294
  delete tile.gltfByteOffset;
74276
74295
  delete tile.gltfByteLength;
@@ -74478,6 +74497,7 @@ async function parseGltf3DTile(tile, arrayBuffer, options, context) {
74478
74497
  tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
74479
74498
  const { parse: parse9 } = context;
74480
74499
  tile.gltf = await parse9(arrayBuffer, GLTFLoader, options, context);
74500
+ tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
74481
74501
  }
74482
74502
 
74483
74503
  // ../3d-tiles/src/lib/parsers/parse-3d-tile.ts
@@ -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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4" !== 'undefined' ? "3.3.4" : '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.4",
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.4",
48
- "@loaders.gl/crypto": "3.3.4",
49
- "@loaders.gl/draco": "3.3.4",
50
- "@loaders.gl/gltf": "3.3.4",
51
- "@loaders.gl/i3s": "3.3.4",
52
- "@loaders.gl/images": "3.3.4",
53
- "@loaders.gl/loader-utils": "3.3.4",
54
- "@loaders.gl/polyfills": "3.3.4",
55
- "@loaders.gl/schema": "3.3.4",
56
- "@loaders.gl/textures": "3.3.4",
57
- "@loaders.gl/tiles": "3.3.4",
58
- "@loaders.gl/worker-utils": "3.3.4",
59
- "@loaders.gl/zip": "3.3.4",
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": "1d1a722ea9a04665acbe41359dfd01bf6d43a214"
83
+ "gitHead": "8aaa7fea4b7d72536d9d1f7d79688ec6702b2904"
84
84
  }