@loaders.gl/3d-tiles 4.3.2 → 4.4.0-alpha.1

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.
@@ -5,7 +5,7 @@ import { DataViewFile } from '@loaders.gl/loader-utils';
5
5
  import { parse3DTilesArchive as parse3DTilesArchiveFromProvider } from "./3d-tiles-archive/3d-tiles-archive-parser.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest';
8
+ const VERSION = typeof "4.4.0-alpha.0" !== 'undefined' ? "4.4.0-alpha.0" : 'latest';
9
9
  /**
10
10
  * Loader for 3tz packages
11
11
  */
package/dist/dist.dev.js CHANGED
@@ -4299,14 +4299,14 @@ var __exports__ = (() => {
4299
4299
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
4300
4300
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
4301
4301
 
4302
- // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
4302
+ // ../../node_modules/@probe.gl/env/dist/lib/globals.js
4303
4303
  var window_2 = globalThis;
4304
4304
  var document_2 = globalThis.document || {};
4305
4305
  var process_ = globalThis.process || {};
4306
4306
  var console_ = globalThis.console;
4307
4307
  var navigator_ = globalThis.navigator || {};
4308
4308
 
4309
- // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
4309
+ // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
4310
4310
  function isElectron(mockUserAgent) {
4311
4311
  if (typeof window !== "undefined" && window.process?.type === "renderer") {
4312
4312
  return true;
@@ -4319,7 +4319,7 @@ var __exports__ = (() => {
4319
4319
  return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
4320
4320
  }
4321
4321
 
4322
- // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
4322
+ // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
4323
4323
  function isBrowser2() {
4324
4324
  const isNode = (
4325
4325
  // @ts-expect-error
@@ -4328,7 +4328,7 @@ var __exports__ = (() => {
4328
4328
  return !isNode || isElectron();
4329
4329
  }
4330
4330
 
4331
- // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
4331
+ // ../../node_modules/@probe.gl/env/dist/index.js
4332
4332
  var VERSION = true ? "4.0.7" : "untranspiled source";
4333
4333
 
4334
4334
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
@@ -4741,8 +4741,10 @@ var __exports__ = (() => {
4741
4741
  return module || null;
4742
4742
  }
4743
4743
 
4744
+ // ../worker-utils/src/lib/npm-tag.ts
4745
+ var NPM_TAG = "beta";
4746
+
4744
4747
  // ../worker-utils/src/lib/env-utils/version.ts
4745
- var NPM_TAG = "latest";
4746
4748
  function getVersion() {
4747
4749
  if (!globalThis._loadersgl_?.version) {
4748
4750
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
@@ -5222,7 +5224,7 @@ var __exports__ = (() => {
5222
5224
  throw new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.");
5223
5225
  }
5224
5226
  /** Read data */
5225
- async read(start, end) {
5227
+ async read(start, length4) {
5226
5228
  throw NOT_IMPLEMENTED;
5227
5229
  }
5228
5230
  /** Write to file. The number of bytes written will be returned */
@@ -10913,35 +10915,88 @@ var __exports__ = (() => {
10913
10915
  return `${String.fromCharCode(dataView.getUint8(byteOffset + 0))}${String.fromCharCode(dataView.getUint8(byteOffset + 1))}${String.fromCharCode(dataView.getUint8(byteOffset + 2))}${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;
10914
10916
  }
10915
10917
 
10918
+ // ../draco/src/lib/draco-module-loader.ts
10919
+ var DRACO_DECODER_VERSION = "1.5.6";
10920
+ var DRACO_ENCODER_VERSION = "1.4.1";
10921
+ var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
10922
+ var DRACO_EXTERNAL_LIBRARIES = {
10923
+ /** The primary Draco3D encoder, javascript wrapper part */
10924
+ DECODER: "draco_wasm_wrapper.js",
10925
+ /** The primary draco decoder, compiled web assembly part */
10926
+ DECODER_WASM: "draco_decoder.wasm",
10927
+ /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
10928
+ FALLBACK_DECODER: "draco_decoder.js",
10929
+ /** Draco encoder */
10930
+ ENCODER: "draco_encoder.js"
10931
+ };
10932
+ var DRACO_EXTERNAL_LIBRARY_URLS = {
10933
+ [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
10934
+ [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
10935
+ [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
10936
+ [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`
10937
+ };
10938
+ var loadDecoderPromise;
10939
+ async function loadDracoDecoderModule(options) {
10940
+ const modules = options.modules || {};
10941
+ if (modules.draco3d) {
10942
+ loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {
10943
+ return { draco };
10944
+ });
10945
+ } else {
10946
+ loadDecoderPromise ||= loadDracoDecoder(options);
10947
+ }
10948
+ return await loadDecoderPromise;
10949
+ }
10950
+ async function loadDracoDecoder(options) {
10951
+ let DracoDecoderModule;
10952
+ let wasmBinary;
10953
+ switch (options.draco && options.draco.decoderType) {
10954
+ case "js":
10955
+ DracoDecoderModule = await loadLibrary(
10956
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
10957
+ "draco",
10958
+ options,
10959
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER
10960
+ );
10961
+ break;
10962
+ case "wasm":
10963
+ default:
10964
+ [DracoDecoderModule, wasmBinary] = await Promise.all([
10965
+ await loadLibrary(
10966
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
10967
+ "draco",
10968
+ options,
10969
+ DRACO_EXTERNAL_LIBRARIES.DECODER
10970
+ ),
10971
+ await loadLibrary(
10972
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
10973
+ "draco",
10974
+ options,
10975
+ DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
10976
+ )
10977
+ ]);
10978
+ }
10979
+ DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
10980
+ return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);
10981
+ }
10982
+ function initializeDracoDecoder(DracoDecoderModule, wasmBinary) {
10983
+ const options = {};
10984
+ if (wasmBinary) {
10985
+ options.wasmBinary = wasmBinary;
10986
+ }
10987
+ return new Promise((resolve2) => {
10988
+ DracoDecoderModule({
10989
+ ...options,
10990
+ onModuleLoaded: (draco) => resolve2({ draco })
10991
+ // Module is Promise-like. Wrap in object to avoid loop.
10992
+ });
10993
+ });
10994
+ }
10995
+
10916
10996
  // ../draco/src/lib/utils/version.ts
10917
10997
  var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10918
10998
 
10919
- // ../draco/src/draco-loader.ts
10920
- var DracoLoader = {
10921
- dataType: null,
10922
- batchType: null,
10923
- name: "Draco",
10924
- id: "draco",
10925
- module: "draco",
10926
- // shapes: ['mesh'],
10927
- version: VERSION4,
10928
- worker: true,
10929
- extensions: ["drc"],
10930
- mimeTypes: ["application/octet-stream"],
10931
- binary: true,
10932
- tests: ["DRACO"],
10933
- options: {
10934
- draco: {
10935
- decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
10936
- // 'js' for IE11
10937
- libraryPath: "libs/",
10938
- extraAttributes: {},
10939
- attributeNameEntry: void 0
10940
- }
10941
- }
10942
- };
10943
-
10944
- // ../schema/src/lib/table/simple-table/data-type.ts
10999
+ // ../schema-utils/src/lib/schema/data-type.ts
10945
11000
  function getDataTypeFromTypedArray(array) {
10946
11001
  switch (array.constructor) {
10947
11002
  case Int8Array:
@@ -10966,7 +11021,7 @@ var __exports__ = (() => {
10966
11021
  }
10967
11022
  }
10968
11023
 
10969
- // ../schema/src/lib/mesh/mesh-utils.ts
11024
+ // ../schema-utils/src/lib/mesh/mesh-utils.ts
10970
11025
  function getMeshBoundingBox(attributes) {
10971
11026
  let minX = Infinity;
10972
11027
  let minY = Infinity;
@@ -10993,7 +11048,7 @@ var __exports__ = (() => {
10993
11048
  ];
10994
11049
  }
10995
11050
 
10996
- // ../schema/src/lib/mesh/deduce-mesh-schema.ts
11051
+ // ../schema-utils/src/lib/mesh/deduce-mesh-schema.ts
10997
11052
  function deduceMeshField(name12, attribute, optionalMetadata) {
10998
11053
  const type = getDataTypeFromTypedArray(attribute.value);
10999
11054
  const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
@@ -11217,6 +11272,7 @@ var __exports__ = (() => {
11217
11272
  case "triangle-strip":
11218
11273
  return {
11219
11274
  topology: "triangle-strip",
11275
+ // TODO - mode is wrong?
11220
11276
  mode: 4,
11221
11277
  // GL.TRIANGLES
11222
11278
  attributes,
@@ -11229,6 +11285,7 @@ var __exports__ = (() => {
11229
11285
  default:
11230
11286
  return {
11231
11287
  topology: "triangle-list",
11288
+ // TODO - mode is wrong?
11232
11289
  mode: 5,
11233
11290
  // GL.TRIANGLE_STRIP
11234
11291
  attributes,
@@ -11513,87 +11570,32 @@ var __exports__ = (() => {
11513
11570
  return intArray;
11514
11571
  }
11515
11572
 
11516
- // ../draco/src/lib/draco-module-loader.ts
11517
- var DRACO_DECODER_VERSION = "1.5.6";
11518
- var DRACO_ENCODER_VERSION = "1.4.1";
11519
- var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
11520
- var DRACO_EXTERNAL_LIBRARIES = {
11521
- /** The primary Draco3D encoder, javascript wrapper part */
11522
- DECODER: "draco_wasm_wrapper.js",
11523
- /** The primary draco decoder, compiled web assembly part */
11524
- DECODER_WASM: "draco_decoder.wasm",
11525
- /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
11526
- FALLBACK_DECODER: "draco_decoder.js",
11527
- /** Draco encoder */
11528
- ENCODER: "draco_encoder.js"
11529
- };
11530
- var DRACO_EXTERNAL_LIBRARY_URLS = {
11531
- [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
11532
- [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
11533
- [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
11534
- [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`
11535
- };
11536
- var loadDecoderPromise;
11537
- async function loadDracoDecoderModule(options) {
11538
- const modules = options.modules || {};
11539
- if (modules.draco3d) {
11540
- loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {
11541
- return { draco };
11542
- });
11543
- } else {
11544
- loadDecoderPromise ||= loadDracoDecoder(options);
11545
- }
11546
- return await loadDecoderPromise;
11547
- }
11548
- async function loadDracoDecoder(options) {
11549
- let DracoDecoderModule;
11550
- let wasmBinary;
11551
- switch (options.draco && options.draco.decoderType) {
11552
- case "js":
11553
- DracoDecoderModule = await loadLibrary(
11554
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
11555
- "draco",
11556
- options,
11557
- DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER
11558
- );
11559
- break;
11560
- case "wasm":
11561
- default:
11562
- [DracoDecoderModule, wasmBinary] = await Promise.all([
11563
- await loadLibrary(
11564
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
11565
- "draco",
11566
- options,
11567
- DRACO_EXTERNAL_LIBRARIES.DECODER
11568
- ),
11569
- await loadLibrary(
11570
- DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
11571
- "draco",
11572
- options,
11573
- DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
11574
- )
11575
- ]);
11576
- }
11577
- DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
11578
- return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);
11579
- }
11580
- function initializeDracoDecoder(DracoDecoderModule, wasmBinary) {
11581
- const options = {};
11582
- if (wasmBinary) {
11583
- options.wasmBinary = wasmBinary;
11573
+ // ../draco/src/draco-loader.ts
11574
+ var DracoWorkerLoader = {
11575
+ dataType: null,
11576
+ batchType: null,
11577
+ name: "Draco",
11578
+ id: "draco",
11579
+ module: "draco",
11580
+ // shapes: ['mesh'],
11581
+ version: VERSION4,
11582
+ worker: true,
11583
+ extensions: ["drc"],
11584
+ mimeTypes: ["application/octet-stream"],
11585
+ binary: true,
11586
+ tests: ["DRACO"],
11587
+ options: {
11588
+ draco: {
11589
+ decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
11590
+ // 'js' for IE11
11591
+ libraryPath: "libs/",
11592
+ extraAttributes: {},
11593
+ attributeNameEntry: void 0
11594
+ }
11584
11595
  }
11585
- return new Promise((resolve2) => {
11586
- DracoDecoderModule({
11587
- ...options,
11588
- onModuleLoaded: (draco) => resolve2({ draco })
11589
- // Module is Promise-like. Wrap in object to avoid loop.
11590
- });
11591
- });
11592
- }
11593
-
11594
- // ../draco/src/index.ts
11595
- var DracoLoader2 = {
11596
- ...DracoLoader,
11596
+ };
11597
+ var DracoLoader = {
11598
+ ...DracoWorkerLoader,
11597
11599
  parse
11598
11600
  };
11599
11601
  async function parse(arrayBuffer, options) {
@@ -12813,7 +12815,7 @@ var __exports__ = (() => {
12813
12815
  }
12814
12816
  };
12815
12817
  delete dracoOptions["3d-tiles"];
12816
- const data = await parseFromContext(dracoData.buffer, DracoLoader2, dracoOptions, context);
12818
+ const data = await parseFromContext(dracoData.buffer, DracoLoader, dracoOptions, context);
12817
12819
  const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
12818
12820
  const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
12819
12821
  const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
@@ -16051,7 +16053,7 @@ var __exports__ = (() => {
16051
16053
  const bufferCopy = sliceArrayBuffer(buffer.buffer, buffer.byteOffset);
16052
16054
  const dracoOptions = { ...options };
16053
16055
  delete dracoOptions["3d-tiles"];
16054
- const decodedData = await parseFromContext(bufferCopy, DracoLoader2, dracoOptions, context);
16056
+ const decodedData = await parseFromContext(bufferCopy, DracoLoader, dracoOptions, context);
16055
16057
  const decodedAttributes = getGLTFAccessors(decodedData.attributes);
16056
16058
  for (const [attributeName, decodedAttribute] of Object.entries(decodedAttributes)) {
16057
16059
  if (attributeName in primitive.attributes) {
@@ -19383,10 +19385,12 @@ var __exports__ = (() => {
19383
19385
  }
19384
19386
  }
19385
19387
  const ionAssetMetadata = await getIonAssetMetadata(accessToken, assetId);
19386
- const { type, url } = ionAssetMetadata;
19388
+ const type = ionAssetMetadata.type;
19389
+ const url = ionAssetMetadata.options?.url || ionAssetMetadata.url;
19387
19390
  assert2(type === "3DTILES" && url);
19388
19391
  ionAssetMetadata.headers = {
19389
- Authorization: `Bearer ${ionAssetMetadata.accessToken}`
19392
+ // Use provided accessToken if a new token is not provided in the ion response
19393
+ Authorization: `Bearer ${ionAssetMetadata.accessToken || accessToken}`
19390
19394
  };
19391
19395
  return ionAssetMetadata;
19392
19396
  }