@loaders.gl/3d-tiles 4.2.0-alpha.4 → 4.2.0-alpha.6
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.js +68 -41
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts +1 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts.map +1 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.js +26 -16
- package/dist/3d-tiles-archive-loader.js +26 -15
- package/dist/cesium-ion-loader.js +34 -30
- package/dist/dist.dev.js +8824 -6420
- package/dist/dist.min.js +32 -0
- package/dist/index.cjs +138 -340
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -1
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +103 -87
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +179 -155
- package/dist/lib/classes/tile-3d-batch-table.d.ts +1 -1
- package/dist/lib/classes/tile-3d-batch-table.js +241 -217
- package/dist/lib/classes/tile-3d-feature-table.js +64 -59
- package/dist/lib/constants.js +19 -15
- package/dist/lib/encoders/encode-3d-tile-batched-model.js +40 -35
- package/dist/lib/encoders/encode-3d-tile-composite.js +19 -17
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js +32 -31
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js +31 -32
- package/dist/lib/encoders/encode-3d-tile.js +23 -19
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js +23 -23
- package/dist/lib/ion/ion.js +55 -54
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +57 -51
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +21 -18
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +35 -20
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +4 -4
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +269 -234
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts +2 -2
- 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 +83 -55
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js +23 -14
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +82 -54
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts +2 -2
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +79 -68
- package/dist/lib/parsers/helpers/parse-utils.js +19 -14
- package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-batched-model.js +21 -17
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-composite.js +18 -14
- 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-gltf.js +22 -14
- package/dist/lib/parsers/parse-3d-tile-header.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +168 -159
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js +153 -123
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js +380 -174
- package/dist/lib/parsers/parse-3d-tile.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile.js +24 -24
- package/dist/lib/utils/obb/s2-corners-to-obb.js +29 -16
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +1 -1
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -1
- package/dist/lib/utils/s2/converters/s2-to-boundary.js +55 -35
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js +31 -20
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts +1 -1
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -1
- package/dist/lib/utils/s2/converters/s2-to-region.js +51 -35
- package/dist/lib/utils/s2/index.d.ts +7 -7
- package/dist/lib/utils/s2/index.d.ts.map +1 -1
- package/dist/lib/utils/s2/index.js +3 -1
- package/dist/lib/utils/s2/s2-geometry-functions.js +19 -5
- package/dist/lib/utils/s2/s2-token-functions.js +51 -22
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +1 -1
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -1
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +23 -9
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js +218 -157
- package/dist/lib/utils/version.js +4 -2
- package/dist/tile-3d-subtree-loader.d.ts +1 -1
- package/dist/tile-3d-subtree-loader.d.ts.map +1 -1
- package/dist/tile-3d-subtree-loader.js +15 -10
- package/dist/tile-3d-writer.js +19 -14
- package/dist/tiles-3d-loader.js +65 -55
- package/dist/types.js +3 -1
- package/package.json +17 -12
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +1 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-archive.js.map +0 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.js.map +0 -1
- package/dist/3d-tiles-archive-loader.js.map +0 -1
- package/dist/cesium-ion-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
- package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
- package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
- package/dist/lib/ion/ion.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
- package/dist/lib/utils/obb/s2-corners-to-obb.js.map +0 -1
- package/dist/lib/utils/s2/converters/s2-to-boundary.js.map +0 -1
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js.map +0 -1
- package/dist/lib/utils/s2/converters/s2-to-region.js.map +0 -1
- package/dist/lib/utils/s2/index.js.map +0 -1
- package/dist/lib/utils/s2/s2-geometry-functions.js.map +0 -1
- package/dist/lib/utils/s2/s2-token-functions.js.map +0 -1
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js.map +0 -1
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js.map +0 -1
- package/dist/lib/utils/version.js.map +0 -1
- package/dist/tile-3d-subtree-loader.js.map +0 -1
- package/dist/tile-3d-writer.js.map +0 -1
- package/dist/tiles-3d-loader.js.map +0 -1
- package/dist/types.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
30
|
+
// dist/index.js
|
|
31
|
+
var dist_exports = {};
|
|
32
|
+
__export(dist_exports, {
|
|
33
33
|
CesiumIonLoader: () => CesiumIonLoader,
|
|
34
34
|
TILE3D_TYPE: () => TILE3D_TYPE,
|
|
35
35
|
Tile3DBatchTable: () => Tile3DBatchTableParser,
|
|
@@ -41,16 +41,16 @@ __export(src_exports, {
|
|
|
41
41
|
Tiles3DLoader: () => Tiles3DLoader,
|
|
42
42
|
_getIonTilesetMetadata: () => getIonTilesetMetadata
|
|
43
43
|
});
|
|
44
|
-
module.exports = __toCommonJS(
|
|
44
|
+
module.exports = __toCommonJS(dist_exports);
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// dist/tiles-3d-loader.js
|
|
47
47
|
var import_loader_utils8 = require("@loaders.gl/loader-utils");
|
|
48
48
|
var import_tiles2 = require("@loaders.gl/tiles");
|
|
49
49
|
|
|
50
|
-
//
|
|
51
|
-
var VERSION =
|
|
50
|
+
// dist/lib/utils/version.js
|
|
51
|
+
var VERSION = true ? "4.2.0-alpha.5" : "latest";
|
|
52
52
|
|
|
53
|
-
//
|
|
53
|
+
// dist/lib/constants.js
|
|
54
54
|
var TILE3D_TYPE = {
|
|
55
55
|
COMPOSITE: "cmpt",
|
|
56
56
|
POINT_CLOUD: "pnts",
|
|
@@ -68,7 +68,7 @@ var MAGIC_ARRAY = {
|
|
|
68
68
|
COMPOSITE: [99, 109, 112, 116]
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
//
|
|
71
|
+
// dist/lib/parsers/helpers/parse-utils.js
|
|
72
72
|
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
73
73
|
function getStringFromArrayBuffer(arrayBuffer, byteOffset, byteLength) {
|
|
74
74
|
(0, import_loader_utils.assert)(arrayBuffer instanceof ArrayBuffer);
|
|
@@ -82,18 +82,20 @@ function getMagicString(arrayBuffer, byteOffset = 0) {
|
|
|
82
82
|
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))}`;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
//
|
|
85
|
+
// dist/lib/parsers/parse-3d-tile-point-cloud.js
|
|
86
86
|
var import_draco = require("@loaders.gl/draco");
|
|
87
87
|
var import_loader_utils4 = require("@loaders.gl/loader-utils");
|
|
88
88
|
var import_math6 = require("@loaders.gl/math");
|
|
89
89
|
var import_core3 = require("@math.gl/core");
|
|
90
90
|
|
|
91
|
-
//
|
|
91
|
+
// dist/lib/classes/tile-3d-feature-table.js
|
|
92
92
|
var import_math = require("@loaders.gl/math");
|
|
93
93
|
var Tile3DFeatureTable = class {
|
|
94
|
+
json;
|
|
95
|
+
buffer;
|
|
96
|
+
featuresLength = 0;
|
|
97
|
+
_cachedTypedArrays = {};
|
|
94
98
|
constructor(featureTableJson, featureTableBinary) {
|
|
95
|
-
this.featuresLength = 0;
|
|
96
|
-
this._cachedTypedArrays = {};
|
|
97
99
|
this.json = featureTableJson;
|
|
98
100
|
this.buffer = featureTableBinary;
|
|
99
101
|
}
|
|
@@ -106,13 +108,7 @@ var Tile3DFeatureTable = class {
|
|
|
106
108
|
getGlobalProperty(propertyName, componentType = import_math.GL.UNSIGNED_INT, componentLength = 1) {
|
|
107
109
|
const jsonValue = this.json[propertyName];
|
|
108
110
|
if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {
|
|
109
|
-
return this._getTypedArrayFromBinary(
|
|
110
|
-
propertyName,
|
|
111
|
-
componentType,
|
|
112
|
-
componentLength,
|
|
113
|
-
1,
|
|
114
|
-
jsonValue.byteOffset
|
|
115
|
-
);
|
|
111
|
+
return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, 1, jsonValue.byteOffset);
|
|
116
112
|
}
|
|
117
113
|
return jsonValue;
|
|
118
114
|
}
|
|
@@ -122,13 +118,7 @@ var Tile3DFeatureTable = class {
|
|
|
122
118
|
if ("componentType" in jsonValue) {
|
|
123
119
|
componentType = import_math.GLType.fromName(jsonValue.componentType);
|
|
124
120
|
}
|
|
125
|
-
return this._getTypedArrayFromBinary(
|
|
126
|
-
propertyName,
|
|
127
|
-
componentType,
|
|
128
|
-
componentLength,
|
|
129
|
-
this.featuresLength,
|
|
130
|
-
jsonValue.byteOffset
|
|
131
|
-
);
|
|
121
|
+
return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, this.featuresLength, jsonValue.byteOffset);
|
|
132
122
|
}
|
|
133
123
|
return this._getTypedArrayFromArray(propertyName, componentType, jsonValue);
|
|
134
124
|
}
|
|
@@ -151,12 +141,7 @@ var Tile3DFeatureTable = class {
|
|
|
151
141
|
const cachedTypedArrays = this._cachedTypedArrays;
|
|
152
142
|
let typedArray = cachedTypedArrays[propertyName];
|
|
153
143
|
if (!typedArray) {
|
|
154
|
-
typedArray = import_math.GLType.createTypedArray(
|
|
155
|
-
componentType,
|
|
156
|
-
this.buffer.buffer,
|
|
157
|
-
this.buffer.byteOffset + byteOffset,
|
|
158
|
-
count * componentLength
|
|
159
|
-
);
|
|
144
|
+
typedArray = import_math.GLType.createTypedArray(componentType, this.buffer.buffer, this.buffer.byteOffset + byteOffset, count * componentLength);
|
|
160
145
|
cachedTypedArrays[propertyName] = typedArray;
|
|
161
146
|
}
|
|
162
147
|
return typedArray;
|
|
@@ -172,10 +157,10 @@ var Tile3DFeatureTable = class {
|
|
|
172
157
|
}
|
|
173
158
|
};
|
|
174
159
|
|
|
175
|
-
//
|
|
160
|
+
// dist/lib/classes/tile-3d-batch-table.js
|
|
176
161
|
var import_loader_utils3 = require("@loaders.gl/loader-utils");
|
|
177
162
|
|
|
178
|
-
//
|
|
163
|
+
// dist/lib/classes/helpers/tile-3d-accessor-utils.js
|
|
179
164
|
var import_math2 = require("@loaders.gl/math");
|
|
180
165
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
181
166
|
var COMPONENTS_PER_ATTRIBUTE = {
|
|
@@ -304,7 +289,7 @@ function createTypedArrayFromAccessor(tile3DAccessor, buffer, byteOffset, length
|
|
|
304
289
|
};
|
|
305
290
|
}
|
|
306
291
|
|
|
307
|
-
//
|
|
292
|
+
// dist/lib/classes/tile-3d-batch-table-hierarchy.js
|
|
308
293
|
var defined = (x) => x !== void 0;
|
|
309
294
|
function initializeHierarchy(batchTable, jsonHeader, binaryBody) {
|
|
310
295
|
if (!jsonHeader) {
|
|
@@ -337,11 +322,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
|
|
|
337
322
|
classIds.componentType = defaultValue(classIds.componentType, GL.UNSIGNED_SHORT);
|
|
338
323
|
classIds.type = AttributeType.SCALAR;
|
|
339
324
|
binaryAccessor = getBinaryAccessor(classIds);
|
|
340
|
-
classIds = binaryAccessor.createArrayBufferView(
|
|
341
|
-
binaryBody.buffer,
|
|
342
|
-
binaryBody.byteOffset + classIds.byteOffset,
|
|
343
|
-
instancesLength
|
|
344
|
-
);
|
|
325
|
+
classIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + classIds.byteOffset, instancesLength);
|
|
345
326
|
}
|
|
346
327
|
let parentIndexes;
|
|
347
328
|
if (defined(parentCounts)) {
|
|
@@ -349,11 +330,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
|
|
|
349
330
|
parentCounts.componentType = defaultValue(parentCounts.componentType, GL.UNSIGNED_SHORT);
|
|
350
331
|
parentCounts.type = AttributeType.SCALAR;
|
|
351
332
|
binaryAccessor = getBinaryAccessor(parentCounts);
|
|
352
|
-
parentCounts = binaryAccessor.createArrayBufferView(
|
|
353
|
-
binaryBody.buffer,
|
|
354
|
-
binaryBody.byteOffset + parentCounts.byteOffset,
|
|
355
|
-
instancesLength
|
|
356
|
-
);
|
|
333
|
+
parentCounts = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentCounts.byteOffset, instancesLength);
|
|
357
334
|
}
|
|
358
335
|
parentIndexes = new Uint16Array(instancesLength);
|
|
359
336
|
parentIdsLength = 0;
|
|
@@ -366,11 +343,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
|
|
|
366
343
|
parentIds.componentType = defaultValue(parentIds.componentType, GL.UNSIGNED_SHORT);
|
|
367
344
|
parentIds.type = AttributeType.SCALAR;
|
|
368
345
|
binaryAccessor = getBinaryAccessor(parentIds);
|
|
369
|
-
parentIds = binaryAccessor.createArrayBufferView(
|
|
370
|
-
binaryBody.buffer,
|
|
371
|
-
binaryBody.byteOffset + parentIds.byteOffset,
|
|
372
|
-
parentIdsLength
|
|
373
|
-
);
|
|
346
|
+
parentIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentIds.byteOffset, parentIdsLength);
|
|
374
347
|
}
|
|
375
348
|
const classesLength = classes.length;
|
|
376
349
|
for (i = 0; i < classesLength; ++i) {
|
|
@@ -474,14 +447,8 @@ function validateInstance(hierarchy, instanceIndex, stack2) {
|
|
|
474
447
|
if (!defined(parentIds)) {
|
|
475
448
|
return;
|
|
476
449
|
}
|
|
477
|
-
assert(
|
|
478
|
-
|
|
479
|
-
`Parent index ${instanceIndex} exceeds the total number of instances: ${instancesLength}`
|
|
480
|
-
);
|
|
481
|
-
assert(
|
|
482
|
-
stack2.indexOf(instanceIndex) === -1,
|
|
483
|
-
"Circular dependency detected in the batch table hierarchy."
|
|
484
|
-
);
|
|
450
|
+
assert(instanceIndex < instancesLength, `Parent index ${instanceIndex} exceeds the total number of instances: ${instancesLength}`);
|
|
451
|
+
assert(stack2.indexOf(instanceIndex) === -1, "Circular dependency detected in the batch table hierarchy.");
|
|
485
452
|
stack2.push(instanceIndex);
|
|
486
453
|
const parentCount = defined(parentCounts) ? parentCounts[instanceIndex] : 1;
|
|
487
454
|
const parentIndex = defined(parentCounts) ? parentIndexes[instanceIndex] : instanceIndex;
|
|
@@ -494,7 +461,7 @@ function validateInstance(hierarchy, instanceIndex, stack2) {
|
|
|
494
461
|
stack2.pop(instanceIndex);
|
|
495
462
|
}
|
|
496
463
|
|
|
497
|
-
//
|
|
464
|
+
// dist/lib/classes/tile-3d-batch-table.js
|
|
498
465
|
function defined2(x) {
|
|
499
466
|
return x !== void 0 && x !== null;
|
|
500
467
|
}
|
|
@@ -506,6 +473,15 @@ var IGNORED_PROPERTY_FIELDS = {
|
|
|
506
473
|
extras: true
|
|
507
474
|
};
|
|
508
475
|
var Tile3DBatchTableParser = class {
|
|
476
|
+
json;
|
|
477
|
+
binary;
|
|
478
|
+
featureCount;
|
|
479
|
+
_extensions;
|
|
480
|
+
// Copy all top-level property fields from the json object, ignoring special fields
|
|
481
|
+
_properties;
|
|
482
|
+
_binaryProperties;
|
|
483
|
+
// TODO: hierarchy support is only partially implemented and not tested
|
|
484
|
+
_hierarchy;
|
|
509
485
|
constructor(json, binary, featureCount, options = {}) {
|
|
510
486
|
var _a;
|
|
511
487
|
(0, import_loader_utils3.assert)(featureCount >= 0);
|
|
@@ -646,12 +622,7 @@ var Tile3DBatchTableParser = class {
|
|
|
646
622
|
const tile3DAccessor = property;
|
|
647
623
|
(0, import_loader_utils3.assert)(this.binary, `Property ${name} requires a batch table binary.`);
|
|
648
624
|
(0, import_loader_utils3.assert)(tile3DAccessor.type, `Property ${name} requires a type.`);
|
|
649
|
-
const accessor = createTypedArrayFromAccessor(
|
|
650
|
-
tile3DAccessor,
|
|
651
|
-
this.binary.buffer,
|
|
652
|
-
this.binary.byteOffset | 0,
|
|
653
|
-
this.featureCount
|
|
654
|
-
);
|
|
625
|
+
const accessor = createTypedArrayFromAccessor(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);
|
|
655
626
|
return {
|
|
656
627
|
typedArray: accessor.values,
|
|
657
628
|
componentCount: accessor.size,
|
|
@@ -722,7 +693,7 @@ var Tile3DBatchTableParser = class {
|
|
|
722
693
|
}
|
|
723
694
|
};
|
|
724
695
|
|
|
725
|
-
//
|
|
696
|
+
// dist/lib/parsers/helpers/parse-3d-tile-header.js
|
|
726
697
|
var SIZEOF_UINT32 = 4;
|
|
727
698
|
function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) {
|
|
728
699
|
const view = new DataView(arrayBuffer);
|
|
@@ -738,7 +709,7 @@ function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) {
|
|
|
738
709
|
return byteOffset;
|
|
739
710
|
}
|
|
740
711
|
|
|
741
|
-
//
|
|
712
|
+
// dist/lib/parsers/helpers/parse-3d-tile-tables.js
|
|
742
713
|
var SIZEOF_UINT322 = 4;
|
|
743
714
|
var DEPRECATION_WARNING = "b3dm tile in legacy format.";
|
|
744
715
|
function parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset) {
|
|
@@ -788,11 +759,7 @@ function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
|
|
|
788
759
|
BATCH_LENGTH: batchLength || 0
|
|
789
760
|
};
|
|
790
761
|
if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {
|
|
791
|
-
const featureTableString = getStringFromArrayBuffer(
|
|
792
|
-
arrayBuffer,
|
|
793
|
-
byteOffset,
|
|
794
|
-
featureTableJsonByteLength
|
|
795
|
-
);
|
|
762
|
+
const featureTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, featureTableJsonByteLength);
|
|
796
763
|
tile.featureTableJson = JSON.parse(featureTableString);
|
|
797
764
|
}
|
|
798
765
|
byteOffset += featureTableJsonByteLength || 0;
|
|
@@ -803,11 +770,7 @@ function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
|
|
|
803
770
|
function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
|
|
804
771
|
const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header || {};
|
|
805
772
|
if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {
|
|
806
|
-
const batchTableString = getStringFromArrayBuffer(
|
|
807
|
-
arrayBuffer,
|
|
808
|
-
byteOffset,
|
|
809
|
-
batchTableJsonByteLength
|
|
810
|
-
);
|
|
773
|
+
const batchTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, batchTableJsonByteLength);
|
|
811
774
|
tile.batchTableJson = JSON.parse(batchTableString);
|
|
812
775
|
byteOffset += batchTableJsonByteLength;
|
|
813
776
|
if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {
|
|
@@ -819,7 +782,7 @@ function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
|
|
|
819
782
|
return byteOffset;
|
|
820
783
|
}
|
|
821
784
|
|
|
822
|
-
//
|
|
785
|
+
// dist/lib/parsers/helpers/normalize-3d-tile-colors.js
|
|
823
786
|
var import_math3 = require("@loaders.gl/math");
|
|
824
787
|
function normalize3DTileColorAttribute(tile, colors, batchTable) {
|
|
825
788
|
if (!colors && (!tile || !tile.batchIds || !batchTable)) {
|
|
@@ -874,7 +837,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
|
|
|
874
837
|
};
|
|
875
838
|
}
|
|
876
839
|
|
|
877
|
-
//
|
|
840
|
+
// dist/lib/parsers/helpers/normalize-3d-tile-normals.js
|
|
878
841
|
var import_core = require("@math.gl/core");
|
|
879
842
|
var import_math4 = require("@loaders.gl/math");
|
|
880
843
|
var scratchNormal = new import_core.Vector3();
|
|
@@ -901,7 +864,7 @@ function normalize3DTileNormalAttribute(tile, normals) {
|
|
|
901
864
|
};
|
|
902
865
|
}
|
|
903
866
|
|
|
904
|
-
//
|
|
867
|
+
// dist/lib/parsers/helpers/normalize-3d-tile-positions.js
|
|
905
868
|
var import_core2 = require("@math.gl/core");
|
|
906
869
|
var import_math5 = require("@loaders.gl/math");
|
|
907
870
|
function normalize3DTilePositionAttribute(tile, positions, options) {
|
|
@@ -928,7 +891,7 @@ function decodeQuantizedPositions(tile, positions) {
|
|
|
928
891
|
return decodedArray;
|
|
929
892
|
}
|
|
930
893
|
|
|
931
|
-
//
|
|
894
|
+
// dist/lib/parsers/parse-3d-tile-point-cloud.js
|
|
932
895
|
async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
933
896
|
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
|
|
934
897
|
byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);
|
|
@@ -981,19 +944,11 @@ function parsePositions(tile, featureTable, options) {
|
|
|
981
944
|
const positions = featureTable.getPropertyArray("POSITION_QUANTIZED", import_math6.GL.UNSIGNED_SHORT, 3);
|
|
982
945
|
tile.isQuantized = true;
|
|
983
946
|
tile.quantizedRange = (1 << 16) - 1;
|
|
984
|
-
tile.quantizedVolumeScale = featureTable.getGlobalProperty(
|
|
985
|
-
"QUANTIZED_VOLUME_SCALE",
|
|
986
|
-
import_math6.GL.FLOAT,
|
|
987
|
-
3
|
|
988
|
-
);
|
|
947
|
+
tile.quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", import_math6.GL.FLOAT, 3);
|
|
989
948
|
if (!tile.quantizedVolumeScale) {
|
|
990
949
|
throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
|
|
991
950
|
}
|
|
992
|
-
tile.quantizedVolumeOffset = featureTable.getGlobalProperty(
|
|
993
|
-
"QUANTIZED_VOLUME_OFFSET",
|
|
994
|
-
import_math6.GL.FLOAT,
|
|
995
|
-
3
|
|
996
|
-
);
|
|
951
|
+
tile.quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", import_math6.GL.FLOAT, 3);
|
|
997
952
|
if (!tile.quantizedVolumeOffset) {
|
|
998
953
|
throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
|
|
999
954
|
}
|
|
@@ -1077,10 +1032,7 @@ async function parseDraco(tile, featureTable, batchTable, options, context) {
|
|
|
1077
1032
|
if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
|
|
1078
1033
|
throw new Error("Draco properties, byteOffset, and byteLength must be defined");
|
|
1079
1034
|
}
|
|
1080
|
-
dracoBuffer = (tile.featureTableBinary || []).slice(
|
|
1081
|
-
dracoByteOffset,
|
|
1082
|
-
dracoByteOffset + dracoByteLength
|
|
1083
|
-
);
|
|
1035
|
+
dracoBuffer = (tile.featureTableBinary || []).slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
|
|
1084
1036
|
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
|
|
1085
1037
|
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
|
|
1086
1038
|
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
|
|
@@ -1151,10 +1103,10 @@ async function loadDraco(tile, dracoData, options, context) {
|
|
|
1151
1103
|
};
|
|
1152
1104
|
}
|
|
1153
1105
|
|
|
1154
|
-
//
|
|
1106
|
+
// dist/lib/parsers/parse-3d-tile-batched-model.js
|
|
1155
1107
|
var import_math7 = require("@loaders.gl/math");
|
|
1156
1108
|
|
|
1157
|
-
//
|
|
1109
|
+
// dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js
|
|
1158
1110
|
var import_gltf = require("@loaders.gl/gltf");
|
|
1159
1111
|
var import_loader_utils5 = require("@loaders.gl/loader-utils");
|
|
1160
1112
|
var GLTF_FORMAT = {
|
|
@@ -1191,12 +1143,7 @@ async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
1191
1143
|
tile.gltfByteOffset = 0;
|
|
1192
1144
|
}
|
|
1193
1145
|
if (tile.gltfArrayBuffer) {
|
|
1194
|
-
const gltfWithBuffers = await (0, import_loader_utils5.parseFromContext)(
|
|
1195
|
-
tile.gltfArrayBuffer,
|
|
1196
|
-
import_gltf.GLTFLoader,
|
|
1197
|
-
options,
|
|
1198
|
-
context
|
|
1199
|
-
);
|
|
1146
|
+
const gltfWithBuffers = await (0, import_loader_utils5.parseFromContext)(tile.gltfArrayBuffer, import_gltf.GLTFLoader, options, context);
|
|
1200
1147
|
tile.gltf = (0, import_gltf.postProcessGLTF)(gltfWithBuffers);
|
|
1201
1148
|
tile.gpuMemoryUsageInBytes = (0, import_gltf._getMemoryUsageGLTF)(tile.gltf);
|
|
1202
1149
|
delete tile.gltfArrayBuffer;
|
|
@@ -1225,7 +1172,7 @@ function extractGLTFBufferOrURL(tile, gltfFormat, options) {
|
|
|
1225
1172
|
}
|
|
1226
1173
|
}
|
|
1227
1174
|
|
|
1228
|
-
//
|
|
1175
|
+
// dist/lib/parsers/parse-3d-tile-batched-model.js
|
|
1229
1176
|
async function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
1230
1177
|
var _a;
|
|
1231
1178
|
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
|
|
@@ -1246,7 +1193,7 @@ function parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
|
1246
1193
|
return byteOffset;
|
|
1247
1194
|
}
|
|
1248
1195
|
|
|
1249
|
-
//
|
|
1196
|
+
// dist/lib/parsers/parse-3d-tile-instanced-model.js
|
|
1250
1197
|
var import_core4 = require("@math.gl/core");
|
|
1251
1198
|
var import_geospatial = require("@math.gl/geospatial");
|
|
1252
1199
|
var import_math8 = require("@loaders.gl/math");
|
|
@@ -1278,11 +1225,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
|
1278
1225
|
}
|
|
1279
1226
|
tile.eastNorthUp = featureTable.getGlobalProperty("EAST_NORTH_UP");
|
|
1280
1227
|
tile.rtcCenter = featureTable.getGlobalProperty("RTC_CENTER", import_math8.GL.FLOAT, 3);
|
|
1281
|
-
const batchTable = new Tile3DBatchTableParser(
|
|
1282
|
-
tile.batchTableJson,
|
|
1283
|
-
tile.batchTableBinary,
|
|
1284
|
-
instancesLength
|
|
1285
|
-
);
|
|
1228
|
+
const batchTable = new Tile3DBatchTableParser(tile.batchTableJson, tile.batchTableBinary, instancesLength);
|
|
1286
1229
|
extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);
|
|
1287
1230
|
return byteOffset;
|
|
1288
1231
|
}
|
|
@@ -1306,32 +1249,14 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
1306
1249
|
if (featureTable.hasProperty("POSITION")) {
|
|
1307
1250
|
position = featureTable.getProperty("POSITION", import_math8.GL.FLOAT, 3, i, instancePosition);
|
|
1308
1251
|
} else if (featureTable.hasProperty("POSITION_QUANTIZED")) {
|
|
1309
|
-
position = featureTable.getProperty(
|
|
1310
|
-
|
|
1311
|
-
import_math8.GL.UNSIGNED_SHORT,
|
|
1312
|
-
3,
|
|
1313
|
-
i,
|
|
1314
|
-
instancePosition
|
|
1315
|
-
);
|
|
1316
|
-
const quantizedVolumeOffset = featureTable.getGlobalProperty(
|
|
1317
|
-
"QUANTIZED_VOLUME_OFFSET",
|
|
1318
|
-
import_math8.GL.FLOAT,
|
|
1319
|
-
3
|
|
1320
|
-
);
|
|
1252
|
+
position = featureTable.getProperty("POSITION_QUANTIZED", import_math8.GL.UNSIGNED_SHORT, 3, i, instancePosition);
|
|
1253
|
+
const quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", import_math8.GL.FLOAT, 3);
|
|
1321
1254
|
if (!quantizedVolumeOffset) {
|
|
1322
|
-
throw new Error(
|
|
1323
|
-
"i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."
|
|
1324
|
-
);
|
|
1255
|
+
throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
|
|
1325
1256
|
}
|
|
1326
|
-
const quantizedVolumeScale = featureTable.getGlobalProperty(
|
|
1327
|
-
"QUANTIZED_VOLUME_SCALE",
|
|
1328
|
-
import_math8.GL.FLOAT,
|
|
1329
|
-
3
|
|
1330
|
-
);
|
|
1257
|
+
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", import_math8.GL.FLOAT, 3);
|
|
1331
1258
|
if (!quantizedVolumeScale) {
|
|
1332
|
-
throw new Error(
|
|
1333
|
-
"i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions."
|
|
1334
|
-
);
|
|
1259
|
+
throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
|
|
1335
1260
|
}
|
|
1336
1261
|
const MAX_UNSIGNED_SHORT = 65535;
|
|
1337
1262
|
for (let j = 0; j < 3; j++) {
|
|
@@ -1352,25 +1277,11 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
1352
1277
|
}
|
|
1353
1278
|
tile.hasCustomOrientation = true;
|
|
1354
1279
|
} else {
|
|
1355
|
-
tile.octNormalUp = featureTable.getProperty(
|
|
1356
|
-
|
|
1357
|
-
import_math8.GL.UNSIGNED_SHORT,
|
|
1358
|
-
2,
|
|
1359
|
-
i,
|
|
1360
|
-
scratch1
|
|
1361
|
-
);
|
|
1362
|
-
tile.octNormalRight = featureTable.getProperty(
|
|
1363
|
-
"NORMAL_RIGHT_OCT32P",
|
|
1364
|
-
import_math8.GL.UNSIGNED_SHORT,
|
|
1365
|
-
2,
|
|
1366
|
-
i,
|
|
1367
|
-
scratch2
|
|
1368
|
-
);
|
|
1280
|
+
tile.octNormalUp = featureTable.getProperty("NORMAL_UP_OCT32P", import_math8.GL.UNSIGNED_SHORT, 2, i, scratch1);
|
|
1281
|
+
tile.octNormalRight = featureTable.getProperty("NORMAL_RIGHT_OCT32P", import_math8.GL.UNSIGNED_SHORT, 2, i, scratch2);
|
|
1369
1282
|
if (tile.octNormalUp) {
|
|
1370
1283
|
if (!tile.octNormalRight) {
|
|
1371
|
-
throw new Error(
|
|
1372
|
-
"i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P"
|
|
1373
|
-
);
|
|
1284
|
+
throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");
|
|
1374
1285
|
}
|
|
1375
1286
|
throw new Error("i3dm: oct-encoded orientation not implemented");
|
|
1376
1287
|
} else if (tile.eastNorthUp) {
|
|
@@ -1416,7 +1327,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
1416
1327
|
tile.instances = instances;
|
|
1417
1328
|
}
|
|
1418
1329
|
|
|
1419
|
-
//
|
|
1330
|
+
// dist/lib/parsers/parse-3d-tile-composite.js
|
|
1420
1331
|
async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile2) {
|
|
1421
1332
|
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
|
|
1422
1333
|
const view = new DataView(arrayBuffer);
|
|
@@ -1431,7 +1342,7 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
|
|
|
1431
1342
|
return byteOffset;
|
|
1432
1343
|
}
|
|
1433
1344
|
|
|
1434
|
-
//
|
|
1345
|
+
// dist/lib/parsers/parse-3d-tile-gltf.js
|
|
1435
1346
|
var import_loader_utils6 = require("@loaders.gl/loader-utils");
|
|
1436
1347
|
var import_gltf2 = require("@loaders.gl/gltf");
|
|
1437
1348
|
async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
@@ -1451,20 +1362,13 @@ async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
|
1451
1362
|
return arrayBuffer.byteLength;
|
|
1452
1363
|
}
|
|
1453
1364
|
|
|
1454
|
-
//
|
|
1365
|
+
// dist/lib/parsers/parse-3d-tile.js
|
|
1455
1366
|
async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = { shape: "tile3d" }) {
|
|
1456
1367
|
tile.byteOffset = byteOffset;
|
|
1457
1368
|
tile.type = getMagicString(arrayBuffer, byteOffset);
|
|
1458
1369
|
switch (tile.type) {
|
|
1459
1370
|
case TILE3D_TYPE.COMPOSITE:
|
|
1460
|
-
return await parseComposite3DTile(
|
|
1461
|
-
tile,
|
|
1462
|
-
arrayBuffer,
|
|
1463
|
-
byteOffset,
|
|
1464
|
-
options,
|
|
1465
|
-
context,
|
|
1466
|
-
parse3DTile
|
|
1467
|
-
);
|
|
1371
|
+
return await parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
|
|
1468
1372
|
case TILE3D_TYPE.BATCHED_3D_MODEL:
|
|
1469
1373
|
return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
|
|
1470
1374
|
case TILE3D_TYPE.GLTF:
|
|
@@ -1478,10 +1382,10 @@ async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile =
|
|
|
1478
1382
|
}
|
|
1479
1383
|
}
|
|
1480
1384
|
|
|
1481
|
-
//
|
|
1385
|
+
// dist/lib/parsers/parse-3d-tile-header.js
|
|
1482
1386
|
var import_loader_utils7 = require("@loaders.gl/loader-utils");
|
|
1483
1387
|
|
|
1484
|
-
//
|
|
1388
|
+
// dist/lib/parsers/helpers/parse-3d-tile-subtree.js
|
|
1485
1389
|
var SUBTREE_FILE_MAGIC = 1952609651;
|
|
1486
1390
|
var SUBTREE_FILE_VERSION = 1;
|
|
1487
1391
|
async function parse3DTilesSubtree(data, options, context) {
|
|
@@ -1509,19 +1413,9 @@ async function parse3DTilesSubtree(data, options, context) {
|
|
|
1509
1413
|
await loadExplicitBitstream(subtree, contentAvailability, internalBinaryBuffer, context);
|
|
1510
1414
|
}
|
|
1511
1415
|
} else {
|
|
1512
|
-
await loadExplicitBitstream(
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
internalBinaryBuffer,
|
|
1516
|
-
context
|
|
1517
|
-
);
|
|
1518
|
-
}
|
|
1519
|
-
await loadExplicitBitstream(
|
|
1520
|
-
subtree,
|
|
1521
|
-
subtree.childSubtreeAvailability,
|
|
1522
|
-
internalBinaryBuffer,
|
|
1523
|
-
context
|
|
1524
|
-
);
|
|
1416
|
+
await loadExplicitBitstream(subtree, subtree.contentAvailability, internalBinaryBuffer, context);
|
|
1417
|
+
}
|
|
1418
|
+
await loadExplicitBitstream(subtree, subtree.childSubtreeAvailability, internalBinaryBuffer, context);
|
|
1525
1419
|
return subtree;
|
|
1526
1420
|
}
|
|
1527
1421
|
async function loadExplicitBitstream(subtree, availabilityObject, internalBinaryBuffer, context) {
|
|
@@ -1541,19 +1435,11 @@ async function loadExplicitBitstream(subtree, availabilityObject, internalBinary
|
|
|
1541
1435
|
const bufferUri = `${(context == null ? void 0 : context.baseUrl) || ""}/${buffer.uri}`;
|
|
1542
1436
|
const response = await context.fetch(bufferUri);
|
|
1543
1437
|
const data = await response.arrayBuffer();
|
|
1544
|
-
availabilityObject.explicitBitstream = new Uint8Array(
|
|
1545
|
-
data,
|
|
1546
|
-
bufferView.byteOffset,
|
|
1547
|
-
bufferView.byteLength
|
|
1548
|
-
);
|
|
1438
|
+
availabilityObject.explicitBitstream = new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
|
|
1549
1439
|
return;
|
|
1550
1440
|
}
|
|
1551
1441
|
const bufferStart = subtree.buffers.slice(0, bufferView.buffer).reduce((offset, buf) => offset + buf.byteLength, 0);
|
|
1552
|
-
availabilityObject.explicitBitstream = new Uint8Array(
|
|
1553
|
-
internalBinaryBuffer.slice(bufferStart, bufferStart + buffer.byteLength),
|
|
1554
|
-
bufferView.byteOffset,
|
|
1555
|
-
bufferView.byteLength
|
|
1556
|
-
);
|
|
1442
|
+
availabilityObject.explicitBitstream = new Uint8Array(internalBinaryBuffer.slice(bufferStart, bufferStart + buffer.byteLength), bufferView.byteOffset, bufferView.byteLength);
|
|
1557
1443
|
}
|
|
1558
1444
|
function parseUint64Value(buffer) {
|
|
1559
1445
|
const dataView = new DataView(buffer);
|
|
@@ -1562,7 +1448,7 @@ function parseUint64Value(buffer) {
|
|
|
1562
1448
|
return left + 2 ** 32 * right;
|
|
1563
1449
|
}
|
|
1564
1450
|
|
|
1565
|
-
//
|
|
1451
|
+
// dist/tile-3d-subtree-loader.js
|
|
1566
1452
|
var Tile3DSubtreeLoader = {
|
|
1567
1453
|
id: "3d-tiles-subtree",
|
|
1568
1454
|
name: "3D Tiles Subtree",
|
|
@@ -1575,15 +1461,15 @@ var Tile3DSubtreeLoader = {
|
|
|
1575
1461
|
options: {}
|
|
1576
1462
|
};
|
|
1577
1463
|
|
|
1578
|
-
//
|
|
1464
|
+
// dist/lib/parsers/parse-3d-tile-header.js
|
|
1579
1465
|
var import_core8 = require("@loaders.gl/core");
|
|
1580
1466
|
var import_tiles = require("@loaders.gl/tiles");
|
|
1581
1467
|
|
|
1582
|
-
//
|
|
1468
|
+
// dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
|
|
1583
1469
|
var import_core7 = require("@loaders.gl/core");
|
|
1584
1470
|
var import_log = __toESM(require("@probe.gl/log"), 1);
|
|
1585
1471
|
|
|
1586
|
-
//
|
|
1472
|
+
// dist/lib/utils/s2/s2-token-functions.js
|
|
1587
1473
|
var import_long = __toESM(require("long"), 1);
|
|
1588
1474
|
var MAXIMUM_TOKEN_LENGTH = 16;
|
|
1589
1475
|
function getS2CellIdFromToken(token) {
|
|
@@ -1616,7 +1502,7 @@ function lsb(cellId) {
|
|
|
1616
1502
|
return cellId.and(cellId.not().add(1));
|
|
1617
1503
|
}
|
|
1618
1504
|
|
|
1619
|
-
//
|
|
1505
|
+
// dist/lib/utils/s2/s2geometry/s2-geometry.js
|
|
1620
1506
|
var import_long2 = __toESM(require("long"), 1);
|
|
1621
1507
|
var FACE_BITS = 3;
|
|
1622
1508
|
var MAX_LEVEL = 30;
|
|
@@ -1733,7 +1619,7 @@ function getS2LngLatFromS2Cell(s2Cell) {
|
|
|
1733
1619
|
return XYZToLngLat(xyz);
|
|
1734
1620
|
}
|
|
1735
1621
|
|
|
1736
|
-
//
|
|
1622
|
+
// dist/lib/utils/s2/converters/s2-to-boundary.js
|
|
1737
1623
|
var MAX_RESOLUTION = 100;
|
|
1738
1624
|
function getS2BoundaryFlatFromS2Cell(s2cell) {
|
|
1739
1625
|
const { face, ij, level } = s2cell;
|
|
@@ -1775,7 +1661,7 @@ function getS2BoundaryFlatFromS2Cell(s2cell) {
|
|
|
1775
1661
|
return result;
|
|
1776
1662
|
}
|
|
1777
1663
|
|
|
1778
|
-
//
|
|
1664
|
+
// dist/lib/utils/s2/s2geometry/s2-cell-utils.js
|
|
1779
1665
|
function getS2Cell(tokenOrKey) {
|
|
1780
1666
|
const key = getS2QuadKey(tokenOrKey);
|
|
1781
1667
|
const s2cell = getS2CellFromQuadKey(key);
|
|
@@ -1789,13 +1675,13 @@ function getS2QuadKey(tokenOrKey) {
|
|
|
1789
1675
|
return getS2QuadkeyFromCellId(id);
|
|
1790
1676
|
}
|
|
1791
1677
|
|
|
1792
|
-
//
|
|
1678
|
+
// dist/lib/utils/s2/s2-geometry-functions.js
|
|
1793
1679
|
function getS2LngLat(s2Token) {
|
|
1794
1680
|
const s2cell = getS2Cell(s2Token);
|
|
1795
1681
|
return getS2LngLatFromS2Cell(s2cell);
|
|
1796
1682
|
}
|
|
1797
1683
|
|
|
1798
|
-
//
|
|
1684
|
+
// dist/lib/utils/s2/converters/s2-to-region.js
|
|
1799
1685
|
function getS2Region(s2cell) {
|
|
1800
1686
|
let region;
|
|
1801
1687
|
if (s2cell.face === 2 || s2cell.face === 5) {
|
|
@@ -1837,7 +1723,7 @@ function get2DRegionFromS2Corners(corners) {
|
|
|
1837
1723
|
};
|
|
1838
1724
|
}
|
|
1839
1725
|
|
|
1840
|
-
//
|
|
1726
|
+
// dist/lib/utils/s2/converters/s2-to-obb-points.js
|
|
1841
1727
|
var import_core5 = require("@math.gl/core");
|
|
1842
1728
|
function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, heightInfo) {
|
|
1843
1729
|
const min = (heightInfo == null ? void 0 : heightInfo.minimumHeight) || 0;
|
|
@@ -1860,7 +1746,7 @@ function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, heightInfo) {
|
|
|
1860
1746
|
return points;
|
|
1861
1747
|
}
|
|
1862
1748
|
|
|
1863
|
-
//
|
|
1749
|
+
// dist/lib/utils/obb/s2-corners-to-obb.js
|
|
1864
1750
|
var import_core6 = require("@math.gl/core");
|
|
1865
1751
|
var import_culling = require("@math.gl/culling");
|
|
1866
1752
|
var import_geospatial2 = require("@math.gl/geospatial");
|
|
@@ -1886,7 +1772,7 @@ function convertS2BoundingVolumetoOBB(s2VolumeInfo) {
|
|
|
1886
1772
|
return box;
|
|
1887
1773
|
}
|
|
1888
1774
|
|
|
1889
|
-
//
|
|
1775
|
+
// dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
|
|
1890
1776
|
var QUADTREE_DIVISION_COUNT = 4;
|
|
1891
1777
|
var OCTREE_DIVISION_COUNT = 8;
|
|
1892
1778
|
var SUBDIVISION_COUNT_MAP = {
|
|
@@ -1922,42 +1808,23 @@ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
|
|
|
1922
1808
|
return void 0;
|
|
1923
1809
|
}
|
|
1924
1810
|
async function parseImplicitTiles(params) {
|
|
1925
|
-
const {
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
level = 0,
|
|
1940
|
-
globalData = {
|
|
1941
|
-
level: 0,
|
|
1942
|
-
mortonIndex: 0,
|
|
1943
|
-
x: 0,
|
|
1944
|
-
y: 0,
|
|
1945
|
-
z: 0
|
|
1946
|
-
}
|
|
1947
|
-
} = params;
|
|
1948
|
-
const {
|
|
1949
|
-
subdivisionScheme,
|
|
1950
|
-
subtreeLevels,
|
|
1951
|
-
maximumLevel,
|
|
1952
|
-
contentUrlTemplate,
|
|
1953
|
-
subtreesUriTemplate,
|
|
1954
|
-
basePath
|
|
1955
|
-
} = implicitOptions;
|
|
1811
|
+
const { implicitOptions, parentData = {
|
|
1812
|
+
mortonIndex: 0,
|
|
1813
|
+
x: 0,
|
|
1814
|
+
y: 0,
|
|
1815
|
+
z: 0
|
|
1816
|
+
}, childIndex = 0, s2VolumeBox, loaderOptions } = params;
|
|
1817
|
+
let { subtree, level = 0, globalData = {
|
|
1818
|
+
level: 0,
|
|
1819
|
+
mortonIndex: 0,
|
|
1820
|
+
x: 0,
|
|
1821
|
+
y: 0,
|
|
1822
|
+
z: 0
|
|
1823
|
+
} } = params;
|
|
1824
|
+
const { subdivisionScheme, subtreeLevels, maximumLevel, contentUrlTemplate, subtreesUriTemplate, basePath } = implicitOptions;
|
|
1956
1825
|
const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
|
|
1957
1826
|
if (!maximumLevel) {
|
|
1958
|
-
import_log.default.once(
|
|
1959
|
-
`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`
|
|
1960
|
-
);
|
|
1827
|
+
import_log.default.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
|
|
1961
1828
|
return tile;
|
|
1962
1829
|
}
|
|
1963
1830
|
const lev = level + globalData.level;
|
|
@@ -1977,10 +1844,7 @@ async function parseImplicitTiles(params) {
|
|
|
1977
1844
|
let childTileZ = concatBits(parentData.z, childZ, 1);
|
|
1978
1845
|
let isChildSubtreeAvailable = false;
|
|
1979
1846
|
if (level >= subtreeLevels) {
|
|
1980
|
-
isChildSubtreeAvailable = getAvailabilityResult(
|
|
1981
|
-
subtree.childSubtreeAvailability,
|
|
1982
|
-
childTileMortonIndex
|
|
1983
|
-
);
|
|
1847
|
+
isChildSubtreeAvailable = getAvailabilityResult(subtree.childSubtreeAvailability, childTileMortonIndex);
|
|
1984
1848
|
}
|
|
1985
1849
|
const x = concatBits(globalData.x, childTileX, level);
|
|
1986
1850
|
const y = concatBits(globalData.y, childTileY, level);
|
|
@@ -2008,21 +1872,14 @@ async function parseImplicitTiles(params) {
|
|
|
2008
1872
|
if (!isTileAvailable) {
|
|
2009
1873
|
return tile;
|
|
2010
1874
|
}
|
|
2011
|
-
const isContentAvailable = getAvailabilityResult(
|
|
2012
|
-
subtree.contentAvailability,
|
|
2013
|
-
tileAvailabilityIndex
|
|
2014
|
-
);
|
|
1875
|
+
const isContentAvailable = getAvailabilityResult(subtree.contentAvailability, tileAvailabilityIndex);
|
|
2015
1876
|
if (isContentAvailable) {
|
|
2016
1877
|
tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, lev, x, y, z);
|
|
2017
1878
|
}
|
|
2018
1879
|
const childTileLevel = level + 1;
|
|
2019
1880
|
const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
|
|
2020
1881
|
for (let index = 0; index < childrenPerTile; index++) {
|
|
2021
|
-
const childS2VolumeBox = getChildS2VolumeBox(
|
|
2022
|
-
s2VolumeBox,
|
|
2023
|
-
index,
|
|
2024
|
-
subdivisionScheme
|
|
2025
|
-
);
|
|
1882
|
+
const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
|
|
2026
1883
|
const childTileParsed = await parseImplicitTiles({
|
|
2027
1884
|
subtree,
|
|
2028
1885
|
implicitOptions,
|
|
@@ -2036,13 +1893,7 @@ async function parseImplicitTiles(params) {
|
|
|
2036
1893
|
if (childTileParsed.contentUrl || childTileParsed.children.length) {
|
|
2037
1894
|
const globalLevel = lev + 1;
|
|
2038
1895
|
const childCoordinates = { childTileX, childTileY, childTileZ };
|
|
2039
|
-
const formattedTile = formatTileData(
|
|
2040
|
-
childTileParsed,
|
|
2041
|
-
globalLevel,
|
|
2042
|
-
childCoordinates,
|
|
2043
|
-
implicitOptions,
|
|
2044
|
-
s2VolumeBox
|
|
2045
|
-
);
|
|
1896
|
+
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
|
|
2046
1897
|
tile.children.push(formattedTile);
|
|
2047
1898
|
}
|
|
2048
1899
|
}
|
|
@@ -2067,23 +1918,11 @@ function getAvailabilityResult(availabilityData, index) {
|
|
|
2067
1918
|
return false;
|
|
2068
1919
|
}
|
|
2069
1920
|
function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
|
|
2070
|
-
const {
|
|
2071
|
-
basePath,
|
|
2072
|
-
refine,
|
|
2073
|
-
getRefine: getRefine2,
|
|
2074
|
-
lodMetricType,
|
|
2075
|
-
getTileType: getTileType2,
|
|
2076
|
-
rootLodMetricValue,
|
|
2077
|
-
rootBoundingVolume
|
|
2078
|
-
} = options;
|
|
1921
|
+
const { basePath, refine, getRefine: getRefine2, lodMetricType, getTileType: getTileType2, rootLodMetricValue, rootBoundingVolume } = options;
|
|
2079
1922
|
const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
|
|
2080
1923
|
const lodMetricValue = rootLodMetricValue / 2 ** level;
|
|
2081
1924
|
const boundingVolume = (s2VolumeBox == null ? void 0 : s2VolumeBox.box) ? { box: s2VolumeBox.box } : rootBoundingVolume;
|
|
2082
|
-
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(
|
|
2083
|
-
level,
|
|
2084
|
-
boundingVolume,
|
|
2085
|
-
childCoordinates
|
|
2086
|
-
);
|
|
1925
|
+
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(level, boundingVolume, childCoordinates);
|
|
2087
1926
|
return {
|
|
2088
1927
|
children: tile.children,
|
|
2089
1928
|
contentUrl: tile.contentUrl,
|
|
@@ -2119,7 +1958,7 @@ function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoo
|
|
|
2119
1958
|
if (rootBoundingVolume.box) {
|
|
2120
1959
|
return rootBoundingVolume;
|
|
2121
1960
|
}
|
|
2122
|
-
throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
|
|
1961
|
+
throw new Error(`Unsupported bounding volume type ${JSON.stringify(rootBoundingVolume)}`);
|
|
2123
1962
|
}
|
|
2124
1963
|
function concatBits(higher, lower, shift) {
|
|
2125
1964
|
return (higher << shift) + lower;
|
|
@@ -2142,7 +1981,7 @@ function getBooleanValueFromBitstream(availabilityIndex, availabilityBuffer) {
|
|
|
2142
1981
|
return bitValue === 1;
|
|
2143
1982
|
}
|
|
2144
1983
|
|
|
2145
|
-
//
|
|
1984
|
+
// dist/lib/parsers/parse-3d-tile-header.js
|
|
2146
1985
|
function getTileType(tile, tileContentUrl = "") {
|
|
2147
1986
|
if (!tileContentUrl) {
|
|
2148
1987
|
return import_tiles.TILE_TYPE.EMPTY;
|
|
@@ -2211,13 +2050,7 @@ async function normalizeTileHeaders(tileset, basePath, options) {
|
|
|
2211
2050
|
let root = null;
|
|
2212
2051
|
const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);
|
|
2213
2052
|
if (rootImplicitTilingExtension && tileset.root) {
|
|
2214
|
-
root = await normalizeImplicitTileHeaders(
|
|
2215
|
-
tileset.root,
|
|
2216
|
-
tileset,
|
|
2217
|
-
basePath,
|
|
2218
|
-
rootImplicitTilingExtension,
|
|
2219
|
-
options
|
|
2220
|
-
);
|
|
2053
|
+
root = await normalizeImplicitTileHeaders(tileset.root, tileset, basePath, rootImplicitTilingExtension, options);
|
|
2221
2054
|
} else {
|
|
2222
2055
|
root = normalizeTileData(tileset.root, basePath);
|
|
2223
2056
|
}
|
|
@@ -2231,13 +2064,7 @@ async function normalizeTileHeaders(tileset, basePath, options) {
|
|
|
2231
2064
|
const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
|
|
2232
2065
|
let childHeaderPostprocessed;
|
|
2233
2066
|
if (childImplicitTilingExtension) {
|
|
2234
|
-
childHeaderPostprocessed = await normalizeImplicitTileHeaders(
|
|
2235
|
-
childHeader,
|
|
2236
|
-
tileset,
|
|
2237
|
-
basePath,
|
|
2238
|
-
childImplicitTilingExtension,
|
|
2239
|
-
options
|
|
2240
|
-
);
|
|
2067
|
+
childHeaderPostprocessed = await normalizeImplicitTileHeaders(childHeader, tileset, basePath, childImplicitTilingExtension, options);
|
|
2241
2068
|
} else {
|
|
2242
2069
|
childHeaderPostprocessed = normalizeTileData(childHeader, basePath);
|
|
2243
2070
|
}
|
|
@@ -2252,13 +2079,7 @@ async function normalizeTileHeaders(tileset, basePath, options) {
|
|
|
2252
2079
|
}
|
|
2253
2080
|
async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTilingExtension, options) {
|
|
2254
2081
|
var _a, _b, _c;
|
|
2255
|
-
const {
|
|
2256
|
-
subdivisionScheme,
|
|
2257
|
-
maximumLevel,
|
|
2258
|
-
availableLevels,
|
|
2259
|
-
subtreeLevels,
|
|
2260
|
-
subtrees: { uri: subtreesUriTemplate }
|
|
2261
|
-
} = implicitTilingExtension;
|
|
2082
|
+
const { subdivisionScheme, maximumLevel, availableLevels, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;
|
|
2262
2083
|
const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
2263
2084
|
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
2264
2085
|
const subtree = await (0, import_core8.load)(subtreeUrl, Tile3DSubtreeLoader, options);
|
|
@@ -2323,7 +2144,7 @@ function getImplicitTilingExtensionData(tile) {
|
|
|
2323
2144
|
return ((_a = tile == null ? void 0 : tile.extensions) == null ? void 0 : _a["3DTILES_implicit_tiling"]) || (tile == null ? void 0 : tile.implicitTiling);
|
|
2324
2145
|
}
|
|
2325
2146
|
|
|
2326
|
-
//
|
|
2147
|
+
// dist/tiles-3d-loader.js
|
|
2327
2148
|
var Tiles3DLoader = {
|
|
2328
2149
|
id: "3d-tiles",
|
|
2329
2150
|
name: "3D Tiles",
|
|
@@ -2387,7 +2208,7 @@ function getBaseUri(tilesetUrl) {
|
|
|
2387
2208
|
return import_loader_utils8.path.dirname(tilesetUrl);
|
|
2388
2209
|
}
|
|
2389
2210
|
|
|
2390
|
-
//
|
|
2211
|
+
// dist/lib/ion/ion.js
|
|
2391
2212
|
var import_core9 = require("@loaders.gl/core");
|
|
2392
2213
|
var import_loader_utils9 = require("@loaders.gl/loader-utils");
|
|
2393
2214
|
var CESIUM_ION_URL = "https://api.cesium.com/v1/assets";
|
|
@@ -2439,7 +2260,7 @@ async function getIonAssetMetadata(accessToken, assetId) {
|
|
|
2439
2260
|
return metadata;
|
|
2440
2261
|
}
|
|
2441
2262
|
|
|
2442
|
-
//
|
|
2263
|
+
// dist/cesium-ion-loader.js
|
|
2443
2264
|
async function preload(url, options = {}) {
|
|
2444
2265
|
options = options["cesium-ion"] || {};
|
|
2445
2266
|
const { accessToken } = options;
|
|
@@ -2470,13 +2291,13 @@ var CesiumIonLoader = {
|
|
|
2470
2291
|
}
|
|
2471
2292
|
};
|
|
2472
2293
|
|
|
2473
|
-
//
|
|
2294
|
+
// dist/3d-tiles-archive-loader.js
|
|
2474
2295
|
var import_loader_utils10 = require("@loaders.gl/loader-utils");
|
|
2475
2296
|
|
|
2476
|
-
//
|
|
2297
|
+
// dist/3d-tiles-archive/3d-tiles-archive-parser.js
|
|
2477
2298
|
var import_zip2 = require("@loaders.gl/zip");
|
|
2478
2299
|
|
|
2479
|
-
//
|
|
2300
|
+
// dist/3d-tiles-archive/3d-tiles-archive-archive.js
|
|
2480
2301
|
var import_crypto = require("@loaders.gl/crypto");
|
|
2481
2302
|
var import_compression = require("@loaders.gl/compression");
|
|
2482
2303
|
var import_zip = require("@loaders.gl/zip");
|
|
@@ -2487,6 +2308,8 @@ var COMPRESSION_METHODS = {
|
|
|
2487
2308
|
8: (data) => new import_compression.DeflateCompression({ raw: true }).decompress(data)
|
|
2488
2309
|
};
|
|
2489
2310
|
var Tiles3DArchive = class extends import_zip.IndexedArchive {
|
|
2311
|
+
/** hash info */
|
|
2312
|
+
hashTable;
|
|
2490
2313
|
/**
|
|
2491
2314
|
* creates Tiles3DArchive handler
|
|
2492
2315
|
* @param fileProvider - FileProvider with the whole file
|
|
@@ -2529,10 +2352,7 @@ var Tiles3DArchive = class extends import_zip.IndexedArchive {
|
|
|
2529
2352
|
if (!localFileHeader) {
|
|
2530
2353
|
return null;
|
|
2531
2354
|
}
|
|
2532
|
-
const compressedFile = await this.fileProvider.slice(
|
|
2533
|
-
localFileHeader.fileDataOffset,
|
|
2534
|
-
localFileHeader.fileDataOffset + localFileHeader.compressedSize
|
|
2535
|
-
);
|
|
2355
|
+
const compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
|
|
2536
2356
|
const compressionMethod = COMPRESSION_METHODS[localFileHeader.compressionMethod];
|
|
2537
2357
|
if (!compressionMethod) {
|
|
2538
2358
|
throw Error("Only Deflation compression is supported");
|
|
@@ -2545,36 +2365,28 @@ var Tiles3DArchive = class extends import_zip.IndexedArchive {
|
|
|
2545
2365
|
}
|
|
2546
2366
|
};
|
|
2547
2367
|
|
|
2548
|
-
//
|
|
2368
|
+
// dist/3d-tiles-archive/3d-tiles-archive-parser.js
|
|
2549
2369
|
var parse3DTilesArchive = async (fileProvider, cb) => {
|
|
2550
2370
|
const hashCDOffset = await (0, import_zip2.searchFromTheEnd)(fileProvider, import_zip2.CD_HEADER_SIGNATURE);
|
|
2551
2371
|
const cdFileHeader = await (0, import_zip2.parseZipCDFileHeader)(hashCDOffset, fileProvider);
|
|
2552
2372
|
let hashTable;
|
|
2553
2373
|
if ((cdFileHeader == null ? void 0 : cdFileHeader.fileName) !== "@3dtilesIndex1@") {
|
|
2554
2374
|
hashTable = await (0, import_zip2.makeHashTableFromZipHeaders)(fileProvider);
|
|
2555
|
-
cb == null ? void 0 : cb(
|
|
2556
|
-
"3tz doesnt contain hash file, hash info has been composed according to zip archive headers"
|
|
2557
|
-
);
|
|
2375
|
+
cb == null ? void 0 : cb("3tz doesnt contain hash file, hash info has been composed according to zip archive headers");
|
|
2558
2376
|
} else {
|
|
2559
|
-
const localFileHeader = await (0, import_zip2.parseZipLocalFileHeader)(
|
|
2560
|
-
cdFileHeader.localHeaderOffset,
|
|
2561
|
-
fileProvider
|
|
2562
|
-
);
|
|
2377
|
+
const localFileHeader = await (0, import_zip2.parseZipLocalFileHeader)(cdFileHeader.localHeaderOffset, fileProvider);
|
|
2563
2378
|
if (!localFileHeader) {
|
|
2564
2379
|
throw new Error("corrupted 3tz zip archive");
|
|
2565
2380
|
}
|
|
2566
2381
|
const fileDataOffset = localFileHeader.fileDataOffset;
|
|
2567
|
-
const hashFile = await fileProvider.slice(
|
|
2568
|
-
fileDataOffset,
|
|
2569
|
-
fileDataOffset + localFileHeader.compressedSize
|
|
2570
|
-
);
|
|
2382
|
+
const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
|
|
2571
2383
|
hashTable = (0, import_zip2.parseHashTable)(hashFile);
|
|
2572
2384
|
}
|
|
2573
2385
|
return new Tiles3DArchive(fileProvider, hashTable);
|
|
2574
2386
|
};
|
|
2575
2387
|
|
|
2576
|
-
//
|
|
2577
|
-
var VERSION2 =
|
|
2388
|
+
// dist/3d-tiles-archive-loader.js
|
|
2389
|
+
var VERSION2 = true ? "4.2.0-alpha.5" : "latest";
|
|
2578
2390
|
var Tiles3DArchiveFileLoader = {
|
|
2579
2391
|
name: "3tz",
|
|
2580
2392
|
id: "3tz",
|
|
@@ -2591,10 +2403,10 @@ async function parse3DTilesArchive2(data, options = {}) {
|
|
|
2591
2403
|
return archive.getFile(((_a = options["3d-tiles-archive"]) == null ? void 0 : _a.path) ?? "");
|
|
2592
2404
|
}
|
|
2593
2405
|
|
|
2594
|
-
//
|
|
2406
|
+
// dist/lib/encoders/encode-3d-tile.js
|
|
2595
2407
|
var import_loader_utils15 = require("@loaders.gl/loader-utils");
|
|
2596
2408
|
|
|
2597
|
-
//
|
|
2409
|
+
// dist/lib/encoders/helpers/encode-3d-tile-header.js
|
|
2598
2410
|
var import_loader_utils11 = require("@loaders.gl/loader-utils");
|
|
2599
2411
|
function encode3DTileHeader(tile, dataView, byteOffset) {
|
|
2600
2412
|
const HEADER_SIZE = 12;
|
|
@@ -2619,7 +2431,7 @@ function encode3DTileByteLength(dataView, byteOffsetTileStart, byteLength) {
|
|
|
2619
2431
|
dataView.setUint32(byteOffsetTileStart + 8, byteLength, true);
|
|
2620
2432
|
}
|
|
2621
2433
|
|
|
2622
|
-
//
|
|
2434
|
+
// dist/lib/encoders/encode-3d-tile-composite.js
|
|
2623
2435
|
function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile2) {
|
|
2624
2436
|
tile = { magic: MAGIC_ARRAY.COMPOSITE, tiles: [], ...tile };
|
|
2625
2437
|
const byteOffsetStart = byteOffset;
|
|
@@ -2635,7 +2447,7 @@ function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile
|
|
|
2635
2447
|
return byteOffset;
|
|
2636
2448
|
}
|
|
2637
2449
|
|
|
2638
|
-
//
|
|
2450
|
+
// dist/lib/encoders/encode-3d-tile-batched-model.js
|
|
2639
2451
|
var import_loader_utils12 = require("@loaders.gl/loader-utils");
|
|
2640
2452
|
function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
|
|
2641
2453
|
const { featuresLength = 0, batchTable } = tile;
|
|
@@ -2668,7 +2480,7 @@ function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
|
|
|
2668
2480
|
return byteOffset;
|
|
2669
2481
|
}
|
|
2670
2482
|
|
|
2671
|
-
//
|
|
2483
|
+
// dist/lib/encoders/encode-3d-tile-instanced-model.js
|
|
2672
2484
|
var import_loader_utils13 = require("@loaders.gl/loader-utils");
|
|
2673
2485
|
function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
|
|
2674
2486
|
const { featuresLength = 1, gltfFormat = 1, gltfUri = "" } = tile;
|
|
@@ -2690,18 +2502,13 @@ function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
|
|
|
2690
2502
|
dataView.setUint32(28, gltfFormat, true);
|
|
2691
2503
|
}
|
|
2692
2504
|
byteOffset += 20;
|
|
2693
|
-
byteOffset += (0, import_loader_utils13.copyStringToDataView)(
|
|
2694
|
-
dataView,
|
|
2695
|
-
byteOffset,
|
|
2696
|
-
featureTableJsonString,
|
|
2697
|
-
featureTableJsonByteLength
|
|
2698
|
-
);
|
|
2505
|
+
byteOffset += (0, import_loader_utils13.copyStringToDataView)(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
|
|
2699
2506
|
byteOffset += (0, import_loader_utils13.copyStringToDataView)(dataView, byteOffset, gltfUri, gltfUriByteLength);
|
|
2700
2507
|
encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
|
|
2701
2508
|
return byteOffset;
|
|
2702
2509
|
}
|
|
2703
2510
|
|
|
2704
|
-
//
|
|
2511
|
+
// dist/lib/encoders/encode-3d-tile-point-cloud.js
|
|
2705
2512
|
var import_loader_utils14 = require("@loaders.gl/loader-utils");
|
|
2706
2513
|
var DEFAULT_FEATURE_TABLE_JSON = {
|
|
2707
2514
|
POINTS_LENGTH: 1,
|
|
@@ -2726,23 +2533,13 @@ function encodePointCloud3DTile(tile, dataView, byteOffset, options) {
|
|
|
2726
2533
|
dataView.setUint32(byteOffset + 12, 0, true);
|
|
2727
2534
|
}
|
|
2728
2535
|
byteOffset += 16;
|
|
2729
|
-
byteOffset += (0, import_loader_utils14.copyStringToDataView)(
|
|
2730
|
-
|
|
2731
|
-
byteOffset,
|
|
2732
|
-
featureTableJsonString,
|
|
2733
|
-
featureTableJsonByteLength
|
|
2734
|
-
);
|
|
2735
|
-
byteOffset += (0, import_loader_utils14.copyBinaryToDataView)(
|
|
2736
|
-
dataView,
|
|
2737
|
-
byteOffset,
|
|
2738
|
-
featureTableBinary,
|
|
2739
|
-
featureTableBinaryByteLength
|
|
2740
|
-
);
|
|
2536
|
+
byteOffset += (0, import_loader_utils14.copyStringToDataView)(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
|
|
2537
|
+
byteOffset += (0, import_loader_utils14.copyBinaryToDataView)(dataView, byteOffset, featureTableBinary, featureTableBinaryByteLength);
|
|
2741
2538
|
encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
|
|
2742
2539
|
return byteOffset;
|
|
2743
2540
|
}
|
|
2744
2541
|
|
|
2745
|
-
//
|
|
2542
|
+
// dist/lib/encoders/encode-3d-tile.js
|
|
2746
2543
|
function encode3DTile(tile, options) {
|
|
2747
2544
|
const byteLength = encode3DTileToDataView(tile, null, 0, options);
|
|
2748
2545
|
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
@@ -2766,7 +2563,7 @@ function encode3DTileToDataView(tile, dataView, byteOffset, options) {
|
|
|
2766
2563
|
}
|
|
2767
2564
|
}
|
|
2768
2565
|
|
|
2769
|
-
//
|
|
2566
|
+
// dist/tile-3d-writer.js
|
|
2770
2567
|
var Tile3DWriter = {
|
|
2771
2568
|
name: "3D Tile",
|
|
2772
2569
|
id: "3d-tiles",
|
|
@@ -2784,3 +2581,4 @@ var Tile3DWriter = {
|
|
|
2784
2581
|
function encodeSync(tile, options) {
|
|
2785
2582
|
return encode3DTile(tile, options);
|
|
2786
2583
|
}
|
|
2584
|
+
//# sourceMappingURL=index.cjs.map
|