@loaders.gl/3d-tiles 4.0.0-alpha.8 → 4.0.0-beta.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.
- package/dist/3d-tiles-archive/3d-tiles-archive-archive.d.ts +30 -0
- package/dist/3d-tiles-archive/3d-tiles-archive-archive.d.ts.map +1 -0
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts +10 -0
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts.map +1 -0
- package/dist/3d-tiles-archive-loader.d.ts +13 -0
- package/dist/3d-tiles-archive-loader.d.ts.map +1 -0
- package/dist/cesium-ion-loader.d.ts +2 -2
- package/dist/cesium-ion-loader.d.ts.map +1 -1
- package/dist/dist.min.js +10981 -4462
- package/dist/es5/3d-tiles-archive/3d-tiles-archive-archive.js +126 -0
- package/dist/es5/3d-tiles-archive/3d-tiles-archive-archive.js.map +1 -0
- package/dist/es5/3d-tiles-archive/3d-tiles-archive-parser.js +69 -0
- package/dist/es5/3d-tiles-archive/3d-tiles-archive-parser.js.map +1 -0
- package/dist/es5/3d-tiles-archive-loader.js +50 -0
- package/dist/es5/3d-tiles-archive-loader.js.map +1 -0
- package/dist/es5/cesium-ion-loader.js.map +1 -1
- package/dist/es5/index.js +14 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/filesystems/tiles-3d-archive-file-system.js +151 -0
- package/dist/es5/lib/filesystems/tiles-3d-archive-file-system.js.map +1 -0
- package/dist/es5/lib/ion/ion.js +3 -9
- package/dist/es5/lib/ion/ion.js.map +1 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +63 -38
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +3 -3
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +70 -55
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js +3 -1
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +14 -12
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +14 -12
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +6 -6
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile.js +3 -1
- package/dist/es5/lib/parsers/parse-3d-tile.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/tile-3d-subtree-loader.js.map +1 -1
- package/dist/es5/tile-3d-writer.js.map +1 -1
- package/dist/es5/tiles-3d-loader.js +2 -0
- package/dist/es5/tiles-3d-loader.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/3d-tiles-archive/3d-tiles-archive-archive.js +46 -0
- package/dist/esm/3d-tiles-archive/3d-tiles-archive-archive.js.map +1 -0
- package/dist/esm/3d-tiles-archive/3d-tiles-archive-parser.js +23 -0
- package/dist/esm/3d-tiles-archive/3d-tiles-archive-parser.js.map +1 -0
- package/dist/esm/3d-tiles-archive-loader.js +20 -0
- package/dist/esm/3d-tiles-archive-loader.js.map +1 -0
- package/dist/esm/cesium-ion-loader.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/filesystems/tiles-3d-archive-file-system.js +49 -0
- package/dist/esm/lib/filesystems/tiles-3d-archive-file-system.js.map +1 -0
- package/dist/esm/lib/ion/ion.js +3 -9
- package/dist/esm/lib/ion/ion.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +45 -23
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +5 -6
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +18 -24
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js +3 -1
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +7 -8
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +8 -5
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +2 -4
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile.js +3 -1
- package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/esm/tile-3d-subtree-loader.js.map +1 -1
- package/dist/esm/tile-3d-writer.js.map +1 -1
- package/dist/esm/tiles-3d-loader.js +2 -0
- package/dist/esm/tiles-3d-loader.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/filesystems/tiles-3d-archive-file-system.d.ts +32 -0
- package/dist/lib/filesystems/tiles-3d-archive-file-system.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +4 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +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-subtree.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.d.ts +30 -2
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile.d.ts +1 -1
- package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -1
- package/dist/tile-3d-subtree-loader.d.ts +3 -3
- package/dist/tile-3d-subtree-loader.d.ts.map +1 -1
- package/dist/tile-3d-writer.d.ts +2 -2
- package/dist/tile-3d-writer.d.ts.map +1 -1
- package/dist/tiles-3d-loader.d.ts +2 -1
- package/dist/tiles-3d-loader.d.ts.map +1 -1
- package/dist/types.d.ts +49 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -8
- package/src/3d-tiles-archive/3d-tiles-archive-archive.ts +85 -0
- package/src/3d-tiles-archive/3d-tiles-archive-parser.ts +52 -0
- package/src/3d-tiles-archive-loader.ts +47 -0
- package/src/cesium-ion-loader.ts +2 -3
- package/src/index.ts +3 -0
- package/src/lib/filesystems/tiles-3d-archive-file-system.ts +97 -0
- package/src/lib/ion/ion.ts +3 -3
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +76 -32
- package/src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts +8 -3
- package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +44 -62
- package/src/lib/parsers/parse-3d-tile-composite.ts +1 -1
- package/src/lib/parsers/parse-3d-tile-gltf.ts +11 -10
- package/src/lib/parsers/parse-3d-tile-header.ts +39 -6
- package/src/lib/parsers/parse-3d-tile-point-cloud.ts +10 -3
- package/src/lib/parsers/parse-3d-tile.ts +2 -2
- package/src/tile-3d-subtree-loader.ts +3 -3
- package/src/tile-3d-writer.ts +2 -2
- package/src/tiles-3d-loader.ts +16 -4
- package/src/types.ts +52 -9
- package/dist/bundle.js +0 -5
- package/dist/cesium-ion-loader.js +0 -41
- package/dist/index.js +0 -26
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +0 -113
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +0 -197
- package/dist/lib/classes/tile-3d-batch-table.js +0 -245
- package/dist/lib/classes/tile-3d-feature-table.js +0 -72
- package/dist/lib/constants.js +0 -26
- package/dist/lib/encoders/encode-3d-tile-batched-model.js +0 -46
- package/dist/lib/encoders/encode-3d-tile-composite.js +0 -24
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js +0 -38
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js +0 -39
- package/dist/lib/encoders/encode-3d-tile.js +0 -33
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js +0 -30
- package/dist/lib/ion/ion.js +0 -68
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -65
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +0 -30
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -42
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +0 -266
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +0 -96
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js +0 -28
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +0 -104
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +0 -93
- package/dist/lib/parsers/helpers/parse-utils.js +0 -32
- package/dist/lib/parsers/parse-3d-tile-batched-model.js +0 -33
- package/dist/lib/parsers/parse-3d-tile-composite.js +0 -24
- package/dist/lib/parsers/parse-3d-tile-gltf.js +0 -28
- package/dist/lib/parsers/parse-3d-tile-header.js +0 -192
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js +0 -172
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js +0 -433
- package/dist/lib/parsers/parse-3d-tile.js +0 -33
- package/dist/lib/utils/obb/s2-corners-to-obb.js +0 -37
- package/dist/lib/utils/s2/converters/s2-to-boundary.js +0 -61
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js +0 -36
- package/dist/lib/utils/s2/converters/s2-to-region.js +0 -59
- package/dist/lib/utils/s2/index.js +0 -23
- package/dist/lib/utils/s2/s2-geometry-functions.js +0 -29
- package/dist/lib/utils/s2/s2-token-functions.js +0 -68
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +0 -32
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js +0 -260
- package/dist/lib/utils/version.js +0 -7
- package/dist/tile-3d-subtree-loader.js +0 -23
- package/dist/tile-3d-writer.js +0 -27
- package/dist/tiles-3d-loader.js +0 -76
- package/dist/types.js +0 -2
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is derived from the Cesium code base under Apache 2 license
|
|
3
|
-
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.parse3DTileHeaderSync = void 0;
|
|
6
|
-
const SIZEOF_UINT32 = 4;
|
|
7
|
-
/* PARSE FIXED HEADER:
|
|
8
|
-
Populates
|
|
9
|
-
magic, // identifies type of tile
|
|
10
|
-
type, // String version of magic
|
|
11
|
-
version,
|
|
12
|
-
byteLength
|
|
13
|
-
*/
|
|
14
|
-
function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) {
|
|
15
|
-
const view = new DataView(arrayBuffer);
|
|
16
|
-
tile.magic = view.getUint32(byteOffset, true);
|
|
17
|
-
byteOffset += SIZEOF_UINT32;
|
|
18
|
-
tile.version = view.getUint32(byteOffset, true);
|
|
19
|
-
byteOffset += SIZEOF_UINT32;
|
|
20
|
-
tile.byteLength = view.getUint32(byteOffset, true);
|
|
21
|
-
byteOffset += SIZEOF_UINT32;
|
|
22
|
-
// TODO - move version check into each tile parser?
|
|
23
|
-
if (tile.version !== 1) {
|
|
24
|
-
throw new Error(`3D Tile Version ${tile.version} not supported`);
|
|
25
|
-
}
|
|
26
|
-
return byteOffset; // Indicates where the parsing ended
|
|
27
|
-
}
|
|
28
|
-
exports.parse3DTileHeaderSync = parse3DTileHeaderSync;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const SUBTREE_FILE_MAGIC = 0x74627573;
|
|
4
|
-
const SUBTREE_FILE_VERSION = 1;
|
|
5
|
-
/**
|
|
6
|
-
* Parse subtree file
|
|
7
|
-
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subtree-file-format
|
|
8
|
-
* @param data
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
// eslint-disable-next-line max-statements
|
|
12
|
-
async function parse3DTilesSubtree(data, options, context) {
|
|
13
|
-
const magic = new Uint32Array(data.slice(0, 4));
|
|
14
|
-
if (magic[0] !== SUBTREE_FILE_MAGIC) {
|
|
15
|
-
throw new Error('Wrong subtree file magic number');
|
|
16
|
-
}
|
|
17
|
-
const version = new Uint32Array(data.slice(4, 8));
|
|
18
|
-
if (version[0] !== SUBTREE_FILE_VERSION) {
|
|
19
|
-
throw new Error('Wrong subtree file verson, must be 1');
|
|
20
|
-
}
|
|
21
|
-
const jsonByteLength = parseUint64Value(data.slice(8, 16));
|
|
22
|
-
const stringAttribute = new Uint8Array(data, 24, jsonByteLength);
|
|
23
|
-
const textDecoder = new TextDecoder('utf8');
|
|
24
|
-
const string = textDecoder.decode(stringAttribute);
|
|
25
|
-
const subtree = JSON.parse(string);
|
|
26
|
-
const binaryByteLength = parseUint64Value(data.slice(16, 24));
|
|
27
|
-
let internalBinaryBuffer = new ArrayBuffer(0);
|
|
28
|
-
if (binaryByteLength) {
|
|
29
|
-
internalBinaryBuffer = data.slice(24 + jsonByteLength);
|
|
30
|
-
}
|
|
31
|
-
if ('bufferView' in subtree.tileAvailability) {
|
|
32
|
-
subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(subtree, 'tileAvailability', internalBinaryBuffer, context);
|
|
33
|
-
}
|
|
34
|
-
if ('bufferView' in subtree.contentAvailability) {
|
|
35
|
-
subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(subtree, 'contentAvailability', internalBinaryBuffer, context);
|
|
36
|
-
}
|
|
37
|
-
if ('bufferView' in subtree.childSubtreeAvailability) {
|
|
38
|
-
subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(subtree, 'childSubtreeAvailability', internalBinaryBuffer, context);
|
|
39
|
-
}
|
|
40
|
-
return subtree;
|
|
41
|
-
}
|
|
42
|
-
exports.default = parse3DTilesSubtree;
|
|
43
|
-
/**
|
|
44
|
-
* Get url for bitstream downloading
|
|
45
|
-
* @param bitstreamRelativeUri
|
|
46
|
-
* @param basePath
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
function resolveBufferUri(bitstreamRelativeUri, basePath) {
|
|
50
|
-
const hasProtocol = basePath.startsWith('http');
|
|
51
|
-
if (hasProtocol) {
|
|
52
|
-
const resolvedUri = new URL(bitstreamRelativeUri, basePath);
|
|
53
|
-
return decodeURI(resolvedUri.toString());
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Adding http protocol only for new URL constructor usage.
|
|
57
|
-
* It allows to resolve relative paths like ../../example with basePath.
|
|
58
|
-
*/
|
|
59
|
-
const basePathWithProtocol = `http://${basePath}`;
|
|
60
|
-
const resolvedUri = new URL(bitstreamRelativeUri, basePathWithProtocol);
|
|
61
|
-
/**
|
|
62
|
-
* Drop protocol and use just relative path.
|
|
63
|
-
*/
|
|
64
|
-
return `/${resolvedUri.host}${resolvedUri.pathname}`;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get explicit bitstream for subtree availability data.
|
|
68
|
-
* @param subtree
|
|
69
|
-
* @param name
|
|
70
|
-
* @param internalBinaryBuffer
|
|
71
|
-
*/
|
|
72
|
-
async function getExplicitBitstream(subtree, name, internalBinaryBuffer, context) {
|
|
73
|
-
const bufferViewIndex = subtree[name].bufferView;
|
|
74
|
-
const bufferView = subtree.bufferViews[bufferViewIndex];
|
|
75
|
-
const buffer = subtree.buffers[bufferView.buffer];
|
|
76
|
-
if (!context?.url || !context.fetch) {
|
|
77
|
-
throw new Error('Url is not provided');
|
|
78
|
-
}
|
|
79
|
-
if (!context.fetch) {
|
|
80
|
-
throw new Error('fetch is not provided');
|
|
81
|
-
}
|
|
82
|
-
// External bitstream loading
|
|
83
|
-
if (buffer.uri) {
|
|
84
|
-
const bufferUri = resolveBufferUri(buffer.uri, context?.url);
|
|
85
|
-
const response = await context.fetch(bufferUri);
|
|
86
|
-
const data = await response.arrayBuffer();
|
|
87
|
-
// Return view of bitstream.
|
|
88
|
-
return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
|
|
89
|
-
}
|
|
90
|
-
// Return view of bitstream.
|
|
91
|
-
return new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Parse buffer to return uint64 value
|
|
95
|
-
* @param buffer
|
|
96
|
-
* @returns 64-bit value until precision is lost after Number.MAX_SAFE_INTEGER
|
|
97
|
-
*/
|
|
98
|
-
function parseUint64Value(buffer) {
|
|
99
|
-
const dataView = new DataView(buffer);
|
|
100
|
-
const left = dataView.getUint32(0, true);
|
|
101
|
-
const right = dataView.getUint32(4, true);
|
|
102
|
-
// combine the two 32-bit values
|
|
103
|
-
return left + 2 ** 32 * right;
|
|
104
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is derived from the Cesium code base under Apache 2 license
|
|
3
|
-
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.parse3DTileTablesSync = exports.parse3DTileTablesHeaderSync = void 0;
|
|
6
|
-
const parse_utils_1 = require("./parse-utils");
|
|
7
|
-
const SIZEOF_UINT32 = 4;
|
|
8
|
-
const DEPRECATION_WARNING = 'b3dm tile in legacy format.';
|
|
9
|
-
// eslint-disable-next-line max-statements
|
|
10
|
-
function parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset) {
|
|
11
|
-
const view = new DataView(arrayBuffer);
|
|
12
|
-
let batchLength;
|
|
13
|
-
tile.header = tile.header || {};
|
|
14
|
-
let featureTableJsonByteLength = view.getUint32(byteOffset, true);
|
|
15
|
-
byteOffset += SIZEOF_UINT32;
|
|
16
|
-
let featureTableBinaryByteLength = view.getUint32(byteOffset, true);
|
|
17
|
-
byteOffset += SIZEOF_UINT32;
|
|
18
|
-
let batchTableJsonByteLength = view.getUint32(byteOffset, true);
|
|
19
|
-
byteOffset += SIZEOF_UINT32;
|
|
20
|
-
let batchTableBinaryByteLength = view.getUint32(byteOffset, true);
|
|
21
|
-
byteOffset += SIZEOF_UINT32;
|
|
22
|
-
// First legacy header format - [batchLength] [batchTableByteLength] ('batchTableJsonByteLength': JSON starts with a quotation mark or the glTF magic)
|
|
23
|
-
// Second legacy format - [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength] (Second legacy format is similar as first but here we check 'batchTableBinaryByteLength' instead)
|
|
24
|
-
// Current header format - [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength]
|
|
25
|
-
// First byte will be 0x22 or 0x67. The minimum uint32 expected is 0x22000000 = 570425344 = 570MB.
|
|
26
|
-
if (batchTableJsonByteLength >= 570425344) {
|
|
27
|
-
byteOffset -= SIZEOF_UINT32 * 2;
|
|
28
|
-
batchLength = featureTableJsonByteLength;
|
|
29
|
-
batchTableJsonByteLength = featureTableBinaryByteLength;
|
|
30
|
-
batchTableBinaryByteLength = 0;
|
|
31
|
-
featureTableJsonByteLength = 0;
|
|
32
|
-
featureTableBinaryByteLength = 0;
|
|
33
|
-
console.warn(DEPRECATION_WARNING); // eslint-disable-line
|
|
34
|
-
}
|
|
35
|
-
else if (batchTableBinaryByteLength >= 570425344) {
|
|
36
|
-
byteOffset -= SIZEOF_UINT32;
|
|
37
|
-
batchLength = batchTableJsonByteLength;
|
|
38
|
-
batchTableJsonByteLength = featureTableJsonByteLength;
|
|
39
|
-
batchTableBinaryByteLength = featureTableBinaryByteLength;
|
|
40
|
-
featureTableJsonByteLength = 0;
|
|
41
|
-
featureTableBinaryByteLength = 0;
|
|
42
|
-
console.warn(DEPRECATION_WARNING); // eslint-disable-line
|
|
43
|
-
}
|
|
44
|
-
tile.header.featureTableJsonByteLength = featureTableJsonByteLength;
|
|
45
|
-
tile.header.featureTableBinaryByteLength = featureTableBinaryByteLength;
|
|
46
|
-
tile.header.batchTableJsonByteLength = batchTableJsonByteLength;
|
|
47
|
-
tile.header.batchTableBinaryByteLength = batchTableBinaryByteLength;
|
|
48
|
-
tile.header.batchLength = batchLength;
|
|
49
|
-
return byteOffset;
|
|
50
|
-
}
|
|
51
|
-
exports.parse3DTileTablesHeaderSync = parse3DTileTablesHeaderSync;
|
|
52
|
-
function parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options) {
|
|
53
|
-
byteOffset = parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options);
|
|
54
|
-
byteOffset = parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options);
|
|
55
|
-
return byteOffset;
|
|
56
|
-
}
|
|
57
|
-
exports.parse3DTileTablesSync = parse3DTileTablesSync;
|
|
58
|
-
function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
|
|
59
|
-
const { featureTableJsonByteLength, featureTableBinaryByteLength, batchLength } = tile.header || {};
|
|
60
|
-
tile.featureTableJson = {
|
|
61
|
-
BATCH_LENGTH: batchLength || 0
|
|
62
|
-
};
|
|
63
|
-
if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {
|
|
64
|
-
const featureTableString = (0, parse_utils_1.getStringFromArrayBuffer)(arrayBuffer, byteOffset, featureTableJsonByteLength);
|
|
65
|
-
tile.featureTableJson = JSON.parse(featureTableString);
|
|
66
|
-
}
|
|
67
|
-
byteOffset += featureTableJsonByteLength || 0;
|
|
68
|
-
tile.featureTableBinary = new Uint8Array(arrayBuffer, byteOffset, featureTableBinaryByteLength);
|
|
69
|
-
byteOffset += featureTableBinaryByteLength || 0;
|
|
70
|
-
/*
|
|
71
|
-
const featureTable = parseFeatureTable(featureTableJson, featureTableBinary);
|
|
72
|
-
|
|
73
|
-
const batchLength = featureTable.getGlobalProperty('BATCH_LENGTH');
|
|
74
|
-
featureTable.featuresLength = batchLength;
|
|
75
|
-
*/
|
|
76
|
-
return byteOffset;
|
|
77
|
-
}
|
|
78
|
-
function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
|
|
79
|
-
const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header || {};
|
|
80
|
-
if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {
|
|
81
|
-
const batchTableString = (0, parse_utils_1.getStringFromArrayBuffer)(arrayBuffer, byteOffset, batchTableJsonByteLength);
|
|
82
|
-
tile.batchTableJson = JSON.parse(batchTableString);
|
|
83
|
-
byteOffset += batchTableJsonByteLength;
|
|
84
|
-
if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {
|
|
85
|
-
// Has a batch table binary
|
|
86
|
-
tile.batchTableBinary = new Uint8Array(arrayBuffer, byteOffset, batchTableBinaryByteLength);
|
|
87
|
-
// Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
|
|
88
|
-
tile.batchTableBinary = new Uint8Array(tile.batchTableBinary);
|
|
89
|
-
byteOffset += batchTableBinaryByteLength;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return byteOffset;
|
|
93
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is derived from the Cesium code base under Apache 2 license
|
|
3
|
-
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getMagicString = exports.getStringFromTypedArray = exports.getStringFromArrayBuffer = void 0;
|
|
6
|
-
const loader_utils_1 = require("@loaders.gl/loader-utils");
|
|
7
|
-
// Decode the JSON binary array into clear text
|
|
8
|
-
function getStringFromArrayBuffer(arrayBuffer, byteOffset, byteLength) {
|
|
9
|
-
(0, loader_utils_1.assert)(arrayBuffer instanceof ArrayBuffer);
|
|
10
|
-
const textDecoder = new TextDecoder('utf8');
|
|
11
|
-
const typedArray = new Uint8Array(arrayBuffer, byteOffset, byteLength);
|
|
12
|
-
const string = textDecoder.decode(typedArray);
|
|
13
|
-
return string;
|
|
14
|
-
}
|
|
15
|
-
exports.getStringFromArrayBuffer = getStringFromArrayBuffer;
|
|
16
|
-
// Decode the JSON binary array into clear text
|
|
17
|
-
function getStringFromTypedArray(typedArray) {
|
|
18
|
-
(0, loader_utils_1.assert)(ArrayBuffer.isView(typedArray));
|
|
19
|
-
const textDecoder = new TextDecoder('utf8');
|
|
20
|
-
const string = textDecoder.decode(typedArray);
|
|
21
|
-
return string;
|
|
22
|
-
}
|
|
23
|
-
exports.getStringFromTypedArray = getStringFromTypedArray;
|
|
24
|
-
function getMagicString(arrayBuffer, byteOffset = 0) {
|
|
25
|
-
const dataView = new DataView(arrayBuffer);
|
|
26
|
-
return `\
|
|
27
|
-
${String.fromCharCode(dataView.getUint8(byteOffset + 0))}\
|
|
28
|
-
${String.fromCharCode(dataView.getUint8(byteOffset + 1))}\
|
|
29
|
-
${String.fromCharCode(dataView.getUint8(byteOffset + 2))}\
|
|
30
|
-
${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;
|
|
31
|
-
}
|
|
32
|
-
exports.getMagicString = getMagicString;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is derived from the Cesium code base under Apache 2 license
|
|
3
|
-
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.parseBatchedModel3DTile = void 0;
|
|
9
|
-
const math_1 = require("@loaders.gl/math"); // math.gl/geometry;
|
|
10
|
-
const tile_3d_feature_table_1 = __importDefault(require("../classes/tile-3d-feature-table"));
|
|
11
|
-
// import Tile3DBatchTable from '../classes/tile-3d-batch-table';
|
|
12
|
-
const parse_3d_tile_header_1 = require("./helpers/parse-3d-tile-header");
|
|
13
|
-
const parse_3d_tile_tables_1 = require("./helpers/parse-3d-tile-tables");
|
|
14
|
-
const parse_3d_tile_gltf_view_1 = require("./helpers/parse-3d-tile-gltf-view");
|
|
15
|
-
async function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
16
|
-
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
|
|
17
|
-
await (0, parse_3d_tile_gltf_view_1.extractGLTF)(tile, parse_3d_tile_gltf_view_1.GLTF_FORMAT.EMBEDDED, options, context);
|
|
18
|
-
const extensions = tile?.gltf?.extensions;
|
|
19
|
-
if (extensions && extensions.CESIUM_RTC) {
|
|
20
|
-
tile.rtcCenter = extensions.CESIUM_RTC.center;
|
|
21
|
-
}
|
|
22
|
-
return byteOffset;
|
|
23
|
-
}
|
|
24
|
-
exports.parseBatchedModel3DTile = parseBatchedModel3DTile;
|
|
25
|
-
function parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
26
|
-
byteOffset = (0, parse_3d_tile_header_1.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
|
|
27
|
-
byteOffset = (0, parse_3d_tile_tables_1.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset);
|
|
28
|
-
byteOffset = (0, parse_3d_tile_tables_1.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
|
|
29
|
-
byteOffset = (0, parse_3d_tile_gltf_view_1.parse3DTileGLTFViewSync)(tile, arrayBuffer, byteOffset, options);
|
|
30
|
-
const featureTable = new tile_3d_feature_table_1.default(tile.featureTableJson, tile.featureTableBinary);
|
|
31
|
-
tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', math_1.GL.FLOAT, 3);
|
|
32
|
-
return byteOffset;
|
|
33
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is derived from the Cesium code base under Apache 2 license
|
|
3
|
-
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.parseComposite3DTile = void 0;
|
|
6
|
-
const parse_3d_tile_header_1 = require("./helpers/parse-3d-tile-header");
|
|
7
|
-
// eslint-disable-next-line max-params
|
|
8
|
-
async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile) {
|
|
9
|
-
byteOffset = (0, parse_3d_tile_header_1.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
|
|
10
|
-
const view = new DataView(arrayBuffer);
|
|
11
|
-
// Extract number of tiles
|
|
12
|
-
tile.tilesLength = view.getUint32(byteOffset, true);
|
|
13
|
-
byteOffset += 4;
|
|
14
|
-
// extract each tile from the byte stream
|
|
15
|
-
tile.tiles = [];
|
|
16
|
-
while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {
|
|
17
|
-
const subtile = {};
|
|
18
|
-
tile.tiles.push(subtile);
|
|
19
|
-
byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);
|
|
20
|
-
// TODO - do we need to add any padding in between tiles?
|
|
21
|
-
}
|
|
22
|
-
return byteOffset;
|
|
23
|
-
}
|
|
24
|
-
exports.parseComposite3DTile = parseComposite3DTile;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseGltf3DTile = void 0;
|
|
4
|
-
const gltf_1 = require("@loaders.gl/gltf");
|
|
5
|
-
async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
6
|
-
// Set flags
|
|
7
|
-
// glTF models need to be rotated from Y to Z up
|
|
8
|
-
// https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up
|
|
9
|
-
tile.rotateYtoZ = true;
|
|
10
|
-
// Save gltf up axis
|
|
11
|
-
tile.gltfUpAxis =
|
|
12
|
-
options?.['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis
|
|
13
|
-
? options['3d-tiles'].assetGltfUpAxis
|
|
14
|
-
: 'Y';
|
|
15
|
-
if (options?.['3d-tiles']?.loadGLTF) {
|
|
16
|
-
if (!context) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const { parse } = context;
|
|
20
|
-
const gltfWithBuffers = await parse(arrayBuffer, gltf_1.GLTFLoader, options, context);
|
|
21
|
-
tile.gltf = (0, gltf_1.postProcessGLTF)(gltfWithBuffers);
|
|
22
|
-
tile.gpuMemoryUsageInBytes = (0, gltf_1._getMemoryUsageGLTF)(tile.gltf);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
tile.gltfArrayBuffer = arrayBuffer;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.parseGltf3DTile = parseGltf3DTile;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeImplicitTileData = exports.normalizeImplicitTileHeaders = exports.normalizeTileHeaders = exports.normalizeTileData = void 0;
|
|
4
|
-
const tile_3d_subtree_loader_1 = require("../../tile-3d-subtree-loader");
|
|
5
|
-
const core_1 = require("@loaders.gl/core");
|
|
6
|
-
const tiles_1 = require("@loaders.gl/tiles");
|
|
7
|
-
const parse_3d_implicit_tiles_1 = require("./helpers/parse-3d-implicit-tiles");
|
|
8
|
-
const s2_corners_to_obb_1 = require("../utils/obb/s2-corners-to-obb");
|
|
9
|
-
function getTileType(tile, tileContentUrl = '') {
|
|
10
|
-
if (!tileContentUrl) {
|
|
11
|
-
return tiles_1.TILE_TYPE.EMPTY;
|
|
12
|
-
}
|
|
13
|
-
const contentUrl = tileContentUrl.split('?')[0]; // Discard query string
|
|
14
|
-
const fileExtension = contentUrl.split('.').pop();
|
|
15
|
-
switch (fileExtension) {
|
|
16
|
-
case 'pnts':
|
|
17
|
-
return tiles_1.TILE_TYPE.POINTCLOUD;
|
|
18
|
-
case 'i3dm':
|
|
19
|
-
case 'b3dm':
|
|
20
|
-
case 'glb':
|
|
21
|
-
case 'gltf':
|
|
22
|
-
return tiles_1.TILE_TYPE.SCENEGRAPH;
|
|
23
|
-
default:
|
|
24
|
-
return fileExtension || tiles_1.TILE_TYPE.EMPTY;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getRefine(refine) {
|
|
28
|
-
switch (refine) {
|
|
29
|
-
case 'REPLACE':
|
|
30
|
-
case 'replace':
|
|
31
|
-
return tiles_1.TILE_REFINEMENT.REPLACE;
|
|
32
|
-
case 'ADD':
|
|
33
|
-
case 'add':
|
|
34
|
-
return tiles_1.TILE_REFINEMENT.ADD;
|
|
35
|
-
default:
|
|
36
|
-
return refine;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function resolveUri(uri = '', basePath) {
|
|
40
|
-
// url scheme per RFC3986
|
|
41
|
-
const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;
|
|
42
|
-
if (urlSchemeRegex.test(basePath)) {
|
|
43
|
-
const url = new URL(uri, `${basePath}/`);
|
|
44
|
-
return decodeURI(url.toString());
|
|
45
|
-
}
|
|
46
|
-
else if (uri.startsWith('/')) {
|
|
47
|
-
return uri;
|
|
48
|
-
}
|
|
49
|
-
return `${basePath}/${uri}`;
|
|
50
|
-
}
|
|
51
|
-
function normalizeTileData(tile, basePath) {
|
|
52
|
-
if (!tile) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
let tileContentUrl;
|
|
56
|
-
if (tile.content) {
|
|
57
|
-
const contentUri = tile.content.uri || tile.content?.url;
|
|
58
|
-
tileContentUrl = resolveUri(contentUri, basePath);
|
|
59
|
-
}
|
|
60
|
-
const tilePostprocessed = {
|
|
61
|
-
...tile,
|
|
62
|
-
id: tileContentUrl,
|
|
63
|
-
contentUrl: tileContentUrl,
|
|
64
|
-
lodMetricType: tiles_1.LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
65
|
-
lodMetricValue: tile.geometricError,
|
|
66
|
-
transformMatrix: tile.transform,
|
|
67
|
-
type: getTileType(tile, tileContentUrl),
|
|
68
|
-
refine: getRefine(tile.refine)
|
|
69
|
-
};
|
|
70
|
-
return tilePostprocessed;
|
|
71
|
-
}
|
|
72
|
-
exports.normalizeTileData = normalizeTileData;
|
|
73
|
-
// normalize tile headers
|
|
74
|
-
async function normalizeTileHeaders(tileset, basePath, options) {
|
|
75
|
-
let root = null;
|
|
76
|
-
const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);
|
|
77
|
-
if (rootImplicitTilingExtension && tileset.root) {
|
|
78
|
-
root = await normalizeImplicitTileHeaders(tileset.root, tileset, basePath, rootImplicitTilingExtension, options);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
root = normalizeTileData(tileset.root, basePath);
|
|
82
|
-
}
|
|
83
|
-
const stack = [];
|
|
84
|
-
stack.push(root);
|
|
85
|
-
while (stack.length > 0) {
|
|
86
|
-
const tile = stack.pop() || {};
|
|
87
|
-
const children = tile.children || [];
|
|
88
|
-
const childrenPostprocessed = [];
|
|
89
|
-
for (const childHeader of children) {
|
|
90
|
-
const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
|
|
91
|
-
let childHeaderPostprocessed;
|
|
92
|
-
if (childImplicitTilingExtension) {
|
|
93
|
-
childHeaderPostprocessed = await normalizeImplicitTileHeaders(childHeader, tileset, basePath, childImplicitTilingExtension, options);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
childHeaderPostprocessed = normalizeTileData(childHeader, basePath);
|
|
97
|
-
}
|
|
98
|
-
if (childHeaderPostprocessed) {
|
|
99
|
-
childrenPostprocessed.push(childHeaderPostprocessed);
|
|
100
|
-
stack.push(childHeaderPostprocessed);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
tile.children = childrenPostprocessed;
|
|
104
|
-
}
|
|
105
|
-
return root;
|
|
106
|
-
}
|
|
107
|
-
exports.normalizeTileHeaders = normalizeTileHeaders;
|
|
108
|
-
/**
|
|
109
|
-
* Do normalisation of implicit tile headers
|
|
110
|
-
* TODO Check if Tile3D class can be a return type here.
|
|
111
|
-
* @param tileset
|
|
112
|
-
*/
|
|
113
|
-
async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTilingExtension, options) {
|
|
114
|
-
const { subdivisionScheme, maximumLevel, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;
|
|
115
|
-
const replacedUrlTemplate = (0, parse_3d_implicit_tiles_1.replaceContentUrlTemplate)(subtreesUriTemplate, 0, 0, 0, 0);
|
|
116
|
-
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
117
|
-
const subtree = await (0, core_1.load)(subtreeUrl, tile_3d_subtree_loader_1.Tile3DSubtreeLoader, options);
|
|
118
|
-
const contentUrlTemplate = resolveUri(tile.content?.uri, basePath);
|
|
119
|
-
const refine = tileset?.root?.refine;
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
const rootLodMetricValue = tile.geometricError;
|
|
122
|
-
// Replace tile.boundingVolume with the the bounding volume specified by the extensions['3DTILES_bounding_volume_S2']
|
|
123
|
-
const s2VolumeInfo = tile.boundingVolume.extensions?.['3DTILES_bounding_volume_S2'];
|
|
124
|
-
if (s2VolumeInfo) {
|
|
125
|
-
const box = (0, s2_corners_to_obb_1.convertS2BoundingVolumetoOBB)(s2VolumeInfo);
|
|
126
|
-
const s2VolumeBox = { box, s2VolumeInfo };
|
|
127
|
-
tile.boundingVolume = s2VolumeBox;
|
|
128
|
-
}
|
|
129
|
-
const rootBoundingVolume = tile.boundingVolume;
|
|
130
|
-
const implicitOptions = {
|
|
131
|
-
contentUrlTemplate,
|
|
132
|
-
subtreesUriTemplate,
|
|
133
|
-
subdivisionScheme,
|
|
134
|
-
subtreeLevels,
|
|
135
|
-
maximumLevel,
|
|
136
|
-
refine,
|
|
137
|
-
basePath,
|
|
138
|
-
lodMetricType: tiles_1.LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
139
|
-
rootLodMetricValue,
|
|
140
|
-
rootBoundingVolume,
|
|
141
|
-
getTileType,
|
|
142
|
-
getRefine
|
|
143
|
-
};
|
|
144
|
-
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
|
|
145
|
-
}
|
|
146
|
-
exports.normalizeImplicitTileHeaders = normalizeImplicitTileHeaders;
|
|
147
|
-
/**
|
|
148
|
-
* Do implicit data normalisation to create hierarchical tile structure
|
|
149
|
-
* @param tile
|
|
150
|
-
* @param rootSubtree
|
|
151
|
-
* @param options
|
|
152
|
-
* @returns
|
|
153
|
-
*/
|
|
154
|
-
async function normalizeImplicitTileData(tile, basePath, rootSubtree, options) {
|
|
155
|
-
if (!tile) {
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
const { children, contentUrl } = await (0, parse_3d_implicit_tiles_1.parseImplicitTiles)({
|
|
159
|
-
subtree: rootSubtree,
|
|
160
|
-
options
|
|
161
|
-
});
|
|
162
|
-
let tileContentUrl;
|
|
163
|
-
let tileContent = null;
|
|
164
|
-
if (contentUrl) {
|
|
165
|
-
tileContentUrl = contentUrl;
|
|
166
|
-
tileContent = { uri: contentUrl.replace(`${basePath}/`, '') };
|
|
167
|
-
}
|
|
168
|
-
const tilePostprocessed = {
|
|
169
|
-
...tile,
|
|
170
|
-
id: tileContentUrl,
|
|
171
|
-
contentUrl: tileContentUrl,
|
|
172
|
-
lodMetricType: tiles_1.LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
173
|
-
lodMetricValue: tile.geometricError,
|
|
174
|
-
transformMatrix: tile.transform,
|
|
175
|
-
type: getTileType(tile, tileContentUrl),
|
|
176
|
-
refine: getRefine(tile.refine),
|
|
177
|
-
content: tileContent || tile.content,
|
|
178
|
-
children
|
|
179
|
-
};
|
|
180
|
-
return tilePostprocessed;
|
|
181
|
-
}
|
|
182
|
-
exports.normalizeImplicitTileData = normalizeImplicitTileData;
|
|
183
|
-
/**
|
|
184
|
-
* Implicit Tiling data can be in 3DTILES_implicit_tiling for 3DTiles v.Next or directly in implicitTiling object for 3DTiles v1.1.
|
|
185
|
-
* Spec 3DTiles v.Next - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling
|
|
186
|
-
* Spec 3DTiles v.1.1 - https://github.com/CesiumGS/3d-tiles/tree/draft-1.1/specification/ImplicitTiling
|
|
187
|
-
* @param tile
|
|
188
|
-
* @returns
|
|
189
|
-
*/
|
|
190
|
-
function getImplicitTilingExtensionData(tile) {
|
|
191
|
-
return tile?.extensions?.['3DTILES_implicit_tiling'] || tile?.implicitTiling;
|
|
192
|
-
}
|