@loaders.gl/tile-converter 4.0.0-alpha.7 → 4.0.0-alpha.8
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-attributes-worker.js +2 -2
- package/dist/3d-tiles-attributes-worker.js.map +2 -2
- package/dist/converter.min.js +67 -67
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/dist.min.js +694 -338
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +2 -2
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +2 -2
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +6 -7
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +25 -14
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +45 -12
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js +82 -0
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-index-document.js +74 -45
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js +111 -0
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/tileset-traversal.js +82 -0
- package/dist/es5/i3s-converter/helpers/tileset-traversal.js.map +1 -0
- package/dist/es5/i3s-converter/i3s-converter.js +545 -516
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js +16 -0
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/README.md +19 -0
- package/dist/es5/i3s-server/app.js +10 -1
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/slpk-controller.js +84 -0
- package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -0
- package/dist/es5/i3s-server/routes/slpk-router.js +71 -0
- package/dist/es5/i3s-server/routes/slpk-router.js.map +1 -0
- package/dist/es5/i3s-server/utils/create-scene-server.js +17 -0
- package/dist/es5/i3s-server/utils/create-scene-server.js.map +1 -0
- package/dist/es5/lib/utils/file-utils.js +1 -1
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +2 -2
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +2 -2
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +6 -7
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +19 -8
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +49 -12
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js +35 -0
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-index-document.js +14 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js +48 -0
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/tileset-traversal.js +14 -0
- package/dist/esm/i3s-converter/helpers/tileset-traversal.js.map +1 -0
- package/dist/esm/i3s-converter/i3s-converter.js +134 -120
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js +10 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/README.md +19 -0
- package/dist/esm/i3s-server/app.js +11 -1
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/controllers/slpk-controller.js +36 -0
- package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -0
- package/dist/esm/i3s-server/routes/slpk-router.js +33 -0
- package/dist/esm/i3s-server/routes/slpk-router.js.map +1 -0
- package/dist/esm/i3s-server/utils/create-scene-server.js +16 -0
- package/dist/esm/i3s-server/utils/create-scene-server.js.map +1 -0
- package/dist/esm/lib/utils/file-utils.js +1 -1
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.js +2 -2
- package/dist/i3s-attributes-worker.js.map +2 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +2 -5
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +3 -4
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +8 -9
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -4
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +34 -12
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +22 -3
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +61 -18
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +18 -0
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/load-3d-tiles.js +53 -0
- package/dist/i3s-converter/helpers/node-index-document.d.ts +8 -0
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +20 -2
- package/dist/i3s-converter/helpers/node-pages.js +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +23 -0
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +76 -0
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +25 -0
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/tileset-traversal.js +29 -0
- package/dist/i3s-converter/i3s-converter.d.ts +40 -40
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +150 -126
- package/dist/i3s-converter/types.d.ts +18 -0
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-converter/types.js +15 -0
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/app.js +9 -1
- package/dist/i3s-server/controllers/slpk-controller.d.ts +3 -0
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -0
- package/dist/i3s-server/controllers/slpk-controller.js +32 -0
- package/dist/i3s-server/routes/slpk-router.d.ts +3 -0
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -0
- package/dist/i3s-server/routes/slpk-router.js +33 -0
- package/dist/i3s-server/utils/create-scene-server.d.ts +11 -0
- package/dist/i3s-server/utils/create-scene-server.d.ts.map +1 -0
- package/dist/i3s-server/utils/create-scene-server.js +14 -0
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +2 -1
- package/dist/lib/utils/lod-conversion-utils.d.ts +3 -2
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/lib/utils/lod-conversion-utils.js +1 -1
- package/package.json +14 -14
- package/src/3d-tiles-converter/3d-tiles-converter.ts +5 -5
- package/src/deps-installer/deps-installer.ts +1 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +2 -5
- package/src/i3s-converter/helpers/coordinate-converter.ts +11 -10
- package/src/i3s-converter/helpers/geometry-converter.ts +51 -19
- package/src/i3s-converter/helpers/gltf-attributes.ts +84 -21
- package/src/i3s-converter/helpers/load-3d-tiles.ts +68 -0
- package/src/i3s-converter/helpers/node-index-document.ts +22 -2
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +81 -0
- package/src/i3s-converter/helpers/tileset-traversal.ts +51 -0
- package/src/i3s-converter/i3s-converter.ts +228 -178
- package/src/i3s-converter/types.ts +20 -0
- package/src/i3s-server/README.md +19 -0
- package/src/i3s-server/app.js +8 -1
- package/src/i3s-server/controllers/slpk-controller.js +38 -0
- package/src/i3s-server/routes/slpk-router.js +33 -0
- package/src/i3s-server/utils/create-scene-server.js +15 -0
- package/src/lib/utils/file-utils.ts +2 -1
- package/src/lib/utils/lod-conversion-utils.ts +6 -2
package/dist/dist.min.js
CHANGED
|
@@ -2173,15 +2173,15 @@ var require_vector3 = __commonJS({
|
|
|
2173
2173
|
}
|
|
2174
2174
|
var ORIGIN = [0, 0, 0];
|
|
2175
2175
|
var ZERO2;
|
|
2176
|
-
var
|
|
2177
|
-
(0, _inherits2.default)(
|
|
2178
|
-
var _super = _createSuper(
|
|
2179
|
-
function
|
|
2176
|
+
var Vector323 = function(_Vector) {
|
|
2177
|
+
(0, _inherits2.default)(Vector324, _Vector);
|
|
2178
|
+
var _super = _createSuper(Vector324);
|
|
2179
|
+
function Vector324() {
|
|
2180
2180
|
var _this;
|
|
2181
2181
|
var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
2182
2182
|
var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
2183
2183
|
var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
2184
|
-
(0, _classCallCheck2.default)(this,
|
|
2184
|
+
(0, _classCallCheck2.default)(this, Vector324);
|
|
2185
2185
|
_this = _super.call(this, -0, -0, -0);
|
|
2186
2186
|
if (arguments.length === 1 && (0, _common.isArray)(x)) {
|
|
2187
2187
|
_this.copy(x);
|
|
@@ -2197,7 +2197,7 @@ var require_vector3 = __commonJS({
|
|
|
2197
2197
|
}
|
|
2198
2198
|
return _this;
|
|
2199
2199
|
}
|
|
2200
|
-
(0, _createClass2.default)(
|
|
2200
|
+
(0, _createClass2.default)(Vector324, [{
|
|
2201
2201
|
key: "set",
|
|
2202
2202
|
value: function set(x, y, z) {
|
|
2203
2203
|
this[0] = x;
|
|
@@ -2318,15 +2318,15 @@ var require_vector3 = __commonJS({
|
|
|
2318
2318
|
key: "ZERO",
|
|
2319
2319
|
get: function get() {
|
|
2320
2320
|
if (!ZERO2) {
|
|
2321
|
-
ZERO2 = new
|
|
2321
|
+
ZERO2 = new Vector324(0, 0, 0);
|
|
2322
2322
|
Object.freeze(ZERO2);
|
|
2323
2323
|
}
|
|
2324
2324
|
return ZERO2;
|
|
2325
2325
|
}
|
|
2326
2326
|
}]);
|
|
2327
|
-
return
|
|
2327
|
+
return Vector324;
|
|
2328
2328
|
}(_vector.default);
|
|
2329
|
-
exports.default =
|
|
2329
|
+
exports.default = Vector323;
|
|
2330
2330
|
}
|
|
2331
2331
|
});
|
|
2332
2332
|
|
|
@@ -5290,12 +5290,12 @@ var require_matrix4 = __commonJS({
|
|
|
5290
5290
|
var DEFAULT_NEAR = 0.1;
|
|
5291
5291
|
var DEFAULT_FAR = 500;
|
|
5292
5292
|
var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
5293
|
-
var
|
|
5294
|
-
(0, _inherits2.default)(
|
|
5295
|
-
var _super = _createSuper(
|
|
5296
|
-
function
|
|
5293
|
+
var Matrix412 = function(_Matrix) {
|
|
5294
|
+
(0, _inherits2.default)(Matrix413, _Matrix);
|
|
5295
|
+
var _super = _createSuper(Matrix413);
|
|
5296
|
+
function Matrix413(array) {
|
|
5297
5297
|
var _this;
|
|
5298
|
-
(0, _classCallCheck2.default)(this,
|
|
5298
|
+
(0, _classCallCheck2.default)(this, Matrix413);
|
|
5299
5299
|
_this = _super.call(this, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
5300
5300
|
if (arguments.length === 1 && Array.isArray(array)) {
|
|
5301
5301
|
_this.copy(array);
|
|
@@ -5304,7 +5304,7 @@ var require_matrix4 = __commonJS({
|
|
|
5304
5304
|
}
|
|
5305
5305
|
return _this;
|
|
5306
5306
|
}
|
|
5307
|
-
(0, _createClass2.default)(
|
|
5307
|
+
(0, _createClass2.default)(Matrix413, [{
|
|
5308
5308
|
key: "ELEMENTS",
|
|
5309
5309
|
get: function get() {
|
|
5310
5310
|
return 16;
|
|
@@ -5685,21 +5685,21 @@ var require_matrix4 = __commonJS({
|
|
|
5685
5685
|
return getZeroMatrix();
|
|
5686
5686
|
}
|
|
5687
5687
|
}]);
|
|
5688
|
-
return
|
|
5688
|
+
return Matrix413;
|
|
5689
5689
|
}(_matrix.default);
|
|
5690
|
-
exports.default =
|
|
5690
|
+
exports.default = Matrix412;
|
|
5691
5691
|
var ZERO2;
|
|
5692
5692
|
var IDENTITY;
|
|
5693
5693
|
function getZeroMatrix() {
|
|
5694
5694
|
if (!ZERO2) {
|
|
5695
|
-
ZERO2 = new
|
|
5695
|
+
ZERO2 = new Matrix412([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
5696
5696
|
Object.freeze(ZERO2);
|
|
5697
5697
|
}
|
|
5698
5698
|
return ZERO2;
|
|
5699
5699
|
}
|
|
5700
5700
|
function getIdentityMatrix() {
|
|
5701
5701
|
if (!IDENTITY) {
|
|
5702
|
-
IDENTITY = new
|
|
5702
|
+
IDENTITY = new Matrix412();
|
|
5703
5703
|
Object.freeze(IDENTITY);
|
|
5704
5704
|
}
|
|
5705
5705
|
return IDENTITY;
|
|
@@ -8167,12 +8167,12 @@ var require_ellipsoid = __commonJS({
|
|
|
8167
8167
|
var scratchPosition3 = new _core.Vector3();
|
|
8168
8168
|
var scratchHeight = new _core.Vector3();
|
|
8169
8169
|
var scratchCartesian = new _core.Vector3();
|
|
8170
|
-
var
|
|
8171
|
-
function
|
|
8170
|
+
var Ellipsoid16 = function() {
|
|
8171
|
+
function Ellipsoid17() {
|
|
8172
8172
|
var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
8173
8173
|
var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
8174
8174
|
var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
8175
|
-
(0, _classCallCheck2.default)(this,
|
|
8175
|
+
(0, _classCallCheck2.default)(this, Ellipsoid17);
|
|
8176
8176
|
(0, _defineProperty2.default)(this, "radii", void 0);
|
|
8177
8177
|
(0, _defineProperty2.default)(this, "radiiSquared", void 0);
|
|
8178
8178
|
(0, _defineProperty2.default)(this, "radiiToTheFourth", void 0);
|
|
@@ -8197,7 +8197,7 @@ var require_ellipsoid = __commonJS({
|
|
|
8197
8197
|
}
|
|
8198
8198
|
Object.freeze(this);
|
|
8199
8199
|
}
|
|
8200
|
-
(0, _createClass2.default)(
|
|
8200
|
+
(0, _createClass2.default)(Ellipsoid17, [{
|
|
8201
8201
|
key: "equals",
|
|
8202
8202
|
value: function equals2(right) {
|
|
8203
8203
|
return this === right || Boolean(right && this.radii.equals(right.radii));
|
|
@@ -8318,10 +8318,10 @@ var require_ellipsoid = __commonJS({
|
|
|
8318
8318
|
return scratchPosition3.set(0, 0, z).to(result);
|
|
8319
8319
|
}
|
|
8320
8320
|
}]);
|
|
8321
|
-
return
|
|
8321
|
+
return Ellipsoid17;
|
|
8322
8322
|
}();
|
|
8323
|
-
exports.default =
|
|
8324
|
-
(0, _defineProperty2.default)(
|
|
8323
|
+
exports.default = Ellipsoid16;
|
|
8324
|
+
(0, _defineProperty2.default)(Ellipsoid16, "WGS84", new Ellipsoid16(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
|
|
8325
8325
|
}
|
|
8326
8326
|
});
|
|
8327
8327
|
|
|
@@ -50030,24 +50030,28 @@ var TILE_CONTENT_STATE = {
|
|
|
50030
50030
|
EXPIRED: 4,
|
|
50031
50031
|
FAILED: 5
|
|
50032
50032
|
};
|
|
50033
|
-
var TILE_REFINEMENT
|
|
50034
|
-
|
|
50035
|
-
|
|
50036
|
-
|
|
50037
|
-
|
|
50038
|
-
|
|
50039
|
-
|
|
50040
|
-
|
|
50041
|
-
|
|
50042
|
-
|
|
50043
|
-
|
|
50044
|
-
|
|
50045
|
-
|
|
50046
|
-
|
|
50047
|
-
|
|
50048
|
-
|
|
50049
|
-
|
|
50050
|
-
|
|
50033
|
+
var TILE_REFINEMENT;
|
|
50034
|
+
(function(TILE_REFINEMENT2) {
|
|
50035
|
+
TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
|
|
50036
|
+
TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
|
|
50037
|
+
})(TILE_REFINEMENT || (TILE_REFINEMENT = {}));
|
|
50038
|
+
var TILE_TYPE;
|
|
50039
|
+
(function(TILE_TYPE2) {
|
|
50040
|
+
TILE_TYPE2["EMPTY"] = "empty";
|
|
50041
|
+
TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
|
|
50042
|
+
TILE_TYPE2["POINTCLOUD"] = "pointcloud";
|
|
50043
|
+
TILE_TYPE2["MESH"] = "mesh";
|
|
50044
|
+
})(TILE_TYPE || (TILE_TYPE = {}));
|
|
50045
|
+
var TILESET_TYPE;
|
|
50046
|
+
(function(TILESET_TYPE2) {
|
|
50047
|
+
TILESET_TYPE2["I3S"] = "I3S";
|
|
50048
|
+
TILESET_TYPE2["TILES3D"] = "TILES3D";
|
|
50049
|
+
})(TILESET_TYPE || (TILESET_TYPE = {}));
|
|
50050
|
+
var LOD_METRIC_TYPE;
|
|
50051
|
+
(function(LOD_METRIC_TYPE2) {
|
|
50052
|
+
LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
|
|
50053
|
+
LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
|
|
50054
|
+
})(LOD_METRIC_TYPE || (LOD_METRIC_TYPE = {}));
|
|
50051
50055
|
var TILE3D_OPTIMIZATION_HINT = {
|
|
50052
50056
|
NOT_COMPUTED: -1,
|
|
50053
50057
|
USE_OPTIMIZATION: 1,
|
|
@@ -51700,7 +51704,7 @@ var Tileset3D = class {
|
|
|
51700
51704
|
throw new Error("Tileset must have an asset property.");
|
|
51701
51705
|
}
|
|
51702
51706
|
if (this.asset.version !== "0.0" && this.asset.version !== "1.0" && this.asset.version !== "1.1") {
|
|
51703
|
-
throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");
|
|
51707
|
+
throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");
|
|
51704
51708
|
}
|
|
51705
51709
|
if ("tilesetVersion" in this.asset) {
|
|
51706
51710
|
this._queryParams.v = this.asset.tilesetVersion;
|
|
@@ -53096,26 +53100,26 @@ function parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options) {
|
|
|
53096
53100
|
return byteOffset;
|
|
53097
53101
|
}
|
|
53098
53102
|
function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
|
|
53099
|
-
const { featureTableJsonByteLength, featureTableBinaryByteLength, batchLength } = tile.header;
|
|
53103
|
+
const { featureTableJsonByteLength, featureTableBinaryByteLength, batchLength } = tile.header || {};
|
|
53100
53104
|
tile.featureTableJson = {
|
|
53101
53105
|
BATCH_LENGTH: batchLength || 0
|
|
53102
53106
|
};
|
|
53103
|
-
if (featureTableJsonByteLength > 0) {
|
|
53107
|
+
if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {
|
|
53104
53108
|
const featureTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, featureTableJsonByteLength);
|
|
53105
53109
|
tile.featureTableJson = JSON.parse(featureTableString);
|
|
53106
53110
|
}
|
|
53107
|
-
byteOffset += featureTableJsonByteLength;
|
|
53111
|
+
byteOffset += featureTableJsonByteLength || 0;
|
|
53108
53112
|
tile.featureTableBinary = new Uint8Array(arrayBuffer, byteOffset, featureTableBinaryByteLength);
|
|
53109
|
-
byteOffset += featureTableBinaryByteLength;
|
|
53113
|
+
byteOffset += featureTableBinaryByteLength || 0;
|
|
53110
53114
|
return byteOffset;
|
|
53111
53115
|
}
|
|
53112
53116
|
function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
|
|
53113
|
-
const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header;
|
|
53114
|
-
if (batchTableJsonByteLength > 0) {
|
|
53117
|
+
const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header || {};
|
|
53118
|
+
if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {
|
|
53115
53119
|
const batchTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, batchTableJsonByteLength);
|
|
53116
53120
|
tile.batchTableJson = JSON.parse(batchTableString);
|
|
53117
53121
|
byteOffset += batchTableJsonByteLength;
|
|
53118
|
-
if (batchTableBinaryByteLength > 0) {
|
|
53122
|
+
if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {
|
|
53119
53123
|
tile.batchTableBinary = new Uint8Array(arrayBuffer, byteOffset, batchTableBinaryByteLength);
|
|
53120
53124
|
tile.batchTableBinary = new Uint8Array(tile.batchTableBinary);
|
|
53121
53125
|
byteOffset += batchTableBinaryByteLength;
|
|
@@ -53129,7 +53133,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
|
|
|
53129
53133
|
if (!colors && (!tile || !tile.batchIds || !batchTable)) {
|
|
53130
53134
|
return null;
|
|
53131
53135
|
}
|
|
53132
|
-
const { batchIds, isRGB565, pointCount } = tile;
|
|
53136
|
+
const { batchIds, isRGB565, pointCount = 0 } = tile;
|
|
53133
53137
|
if (batchIds && batchTable) {
|
|
53134
53138
|
const colorArray = new Uint8ClampedArray(pointCount * 3);
|
|
53135
53139
|
for (let i = 0; i < pointCount; i++) {
|
|
@@ -53147,7 +53151,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
|
|
|
53147
53151
|
normalized: true
|
|
53148
53152
|
};
|
|
53149
53153
|
}
|
|
53150
|
-
if (isRGB565) {
|
|
53154
|
+
if (colors && isRGB565) {
|
|
53151
53155
|
const colorArray = new Uint8ClampedArray(pointCount * 3);
|
|
53152
53156
|
for (let i = 0; i < pointCount; i++) {
|
|
53153
53157
|
const color = decodeRGB565(colors[i]);
|
|
@@ -53172,7 +53176,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
|
|
|
53172
53176
|
}
|
|
53173
53177
|
return {
|
|
53174
53178
|
type: GL2.UNSIGNED_BYTE,
|
|
53175
|
-
value: colors,
|
|
53179
|
+
value: colors || new Uint8ClampedArray(),
|
|
53176
53180
|
size: 4,
|
|
53177
53181
|
normalized: true
|
|
53178
53182
|
};
|
|
@@ -53186,8 +53190,8 @@ function normalize3DTileNormalAttribute(tile, normals) {
|
|
|
53186
53190
|
return null;
|
|
53187
53191
|
}
|
|
53188
53192
|
if (tile.isOctEncoded16P) {
|
|
53189
|
-
const decodedArray = new Float32Array(tile.pointsLength * 3);
|
|
53190
|
-
for (let i = 0; i < tile.pointsLength; i++) {
|
|
53193
|
+
const decodedArray = new Float32Array((tile.pointsLength || 0) * 3);
|
|
53194
|
+
for (let i = 0; i < (tile.pointsLength || 0); i++) {
|
|
53191
53195
|
octDecode(normals[i * 2], normals[i * 2 + 1], scratchNormal);
|
|
53192
53196
|
scratchNormal.toArray(decodedArray, i * 3);
|
|
53193
53197
|
}
|
|
@@ -53270,6 +53274,12 @@ function parsePointCloudTables(tile) {
|
|
|
53270
53274
|
return { featureTable, batchTable };
|
|
53271
53275
|
}
|
|
53272
53276
|
function parsePositions(tile, featureTable, options) {
|
|
53277
|
+
tile.attributes = tile.attributes || {
|
|
53278
|
+
positions: null,
|
|
53279
|
+
colors: null,
|
|
53280
|
+
normals: null,
|
|
53281
|
+
batchIds: null
|
|
53282
|
+
};
|
|
53273
53283
|
if (!tile.attributes.positions) {
|
|
53274
53284
|
if (featureTable.hasProperty("POSITION")) {
|
|
53275
53285
|
tile.attributes.positions = featureTable.getPropertyArray("POSITION", GL2.FLOAT, 3);
|
|
@@ -53293,6 +53303,12 @@ function parsePositions(tile, featureTable, options) {
|
|
|
53293
53303
|
}
|
|
53294
53304
|
}
|
|
53295
53305
|
function parseColors(tile, featureTable, batchTable) {
|
|
53306
|
+
tile.attributes = tile.attributes || {
|
|
53307
|
+
positions: null,
|
|
53308
|
+
colors: null,
|
|
53309
|
+
normals: null,
|
|
53310
|
+
batchIds: null
|
|
53311
|
+
};
|
|
53296
53312
|
if (!tile.attributes.colors) {
|
|
53297
53313
|
let colors = null;
|
|
53298
53314
|
if (featureTable.hasProperty("RGBA")) {
|
|
@@ -53311,6 +53327,12 @@ function parseColors(tile, featureTable, batchTable) {
|
|
|
53311
53327
|
}
|
|
53312
53328
|
}
|
|
53313
53329
|
function parseNormals(tile, featureTable) {
|
|
53330
|
+
tile.attributes = tile.attributes || {
|
|
53331
|
+
positions: null,
|
|
53332
|
+
colors: null,
|
|
53333
|
+
normals: null,
|
|
53334
|
+
batchIds: null
|
|
53335
|
+
};
|
|
53314
53336
|
if (!tile.attributes.normals) {
|
|
53315
53337
|
let normals = null;
|
|
53316
53338
|
if (featureTable.hasProperty("NORMAL")) {
|
|
@@ -53353,7 +53375,7 @@ async function parseDraco(tile, featureTable, batchTable, options, context) {
|
|
|
53353
53375
|
if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
|
|
53354
53376
|
throw new Error("Draco properties, byteOffset, and byteLength must be defined");
|
|
53355
53377
|
}
|
|
53356
|
-
dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
|
|
53378
|
+
dracoBuffer = (tile.featureTableBinary || []).slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
|
|
53357
53379
|
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
|
|
53358
53380
|
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
|
|
53359
53381
|
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
|
|
@@ -53373,11 +53395,14 @@ async function parseDraco(tile, featureTable, batchTable, options, context) {
|
|
|
53373
53395
|
return await loadDraco(tile, dracoData, options, context);
|
|
53374
53396
|
}
|
|
53375
53397
|
async function loadDraco(tile, dracoData, options, context) {
|
|
53398
|
+
if (!context) {
|
|
53399
|
+
return;
|
|
53400
|
+
}
|
|
53376
53401
|
const { parse: parse7 } = context;
|
|
53377
53402
|
const dracoOptions = {
|
|
53378
53403
|
...options,
|
|
53379
53404
|
draco: {
|
|
53380
|
-
...options
|
|
53405
|
+
...options?.draco,
|
|
53381
53406
|
extraAttributes: dracoData.batchTableProperties || {}
|
|
53382
53407
|
}
|
|
53383
53408
|
};
|
|
@@ -55023,7 +55048,8 @@ var GLTFScenegraph = class {
|
|
|
55023
55048
|
constructor(gltf) {
|
|
55024
55049
|
this.gltf = {
|
|
55025
55050
|
json: gltf?.json || makeDefaultGLTFJson(),
|
|
55026
|
-
buffers: gltf?.buffers || []
|
|
55051
|
+
buffers: gltf?.buffers || [],
|
|
55052
|
+
images: gltf?.images || []
|
|
55027
55053
|
};
|
|
55028
55054
|
this.sourceBuffers = [];
|
|
55029
55055
|
this.byteLength = 0;
|
|
@@ -55279,14 +55305,14 @@ var GLTFScenegraph = class {
|
|
|
55279
55305
|
this.json.images.push(glTFImage);
|
|
55280
55306
|
return this.json.images.length - 1;
|
|
55281
55307
|
}
|
|
55282
|
-
addBufferView(buffer) {
|
|
55308
|
+
addBufferView(buffer, bufferIndex = 0, byteOffset = this.byteLength) {
|
|
55283
55309
|
const byteLength = buffer.byteLength;
|
|
55284
55310
|
assert6(Number.isFinite(byteLength));
|
|
55285
55311
|
this.sourceBuffers = this.sourceBuffers || [];
|
|
55286
55312
|
this.sourceBuffers.push(buffer);
|
|
55287
55313
|
const glTFBufferView = {
|
|
55288
|
-
buffer:
|
|
55289
|
-
byteOffset
|
|
55314
|
+
buffer: bufferIndex,
|
|
55315
|
+
byteOffset,
|
|
55290
55316
|
byteLength
|
|
55291
55317
|
};
|
|
55292
55318
|
this.byteLength += padToNBytes(byteLength, 4);
|
|
@@ -56171,18 +56197,16 @@ __export(EXT_feature_metadata_exports, {
|
|
|
56171
56197
|
});
|
|
56172
56198
|
var EXT_FEATURE_METADATA = "EXT_feature_metadata";
|
|
56173
56199
|
var name9 = EXT_FEATURE_METADATA;
|
|
56174
|
-
async function decode8(gltfData) {
|
|
56200
|
+
async function decode8(gltfData, options) {
|
|
56175
56201
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
56176
|
-
decodeExtFeatureMetadata(scenegraph);
|
|
56202
|
+
decodeExtFeatureMetadata(scenegraph, options);
|
|
56177
56203
|
}
|
|
56178
|
-
function decodeExtFeatureMetadata(scenegraph) {
|
|
56204
|
+
function decodeExtFeatureMetadata(scenegraph, options) {
|
|
56179
56205
|
const extension = scenegraph.getExtension(EXT_FEATURE_METADATA);
|
|
56180
|
-
|
|
56181
|
-
|
|
56182
|
-
const
|
|
56183
|
-
|
|
56184
|
-
console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');
|
|
56185
|
-
}
|
|
56206
|
+
if (!extension)
|
|
56207
|
+
return;
|
|
56208
|
+
const schemaClasses = extension.schema?.classes;
|
|
56209
|
+
const { featureTables } = extension;
|
|
56186
56210
|
if (schemaClasses && featureTables) {
|
|
56187
56211
|
for (const schemaName in schemaClasses) {
|
|
56188
56212
|
const schemaClass = schemaClasses[schemaName];
|
|
@@ -56192,6 +56216,16 @@ function decodeExtFeatureMetadata(scenegraph) {
|
|
|
56192
56216
|
}
|
|
56193
56217
|
}
|
|
56194
56218
|
}
|
|
56219
|
+
const { featureTextures } = extension;
|
|
56220
|
+
if (schemaClasses && featureTextures && options.gltf?.loadImages) {
|
|
56221
|
+
for (const schemaName in schemaClasses) {
|
|
56222
|
+
const schemaClass = schemaClasses[schemaName];
|
|
56223
|
+
const featureTexture = findFeatureTextureByName(featureTextures, schemaName);
|
|
56224
|
+
if (featureTexture) {
|
|
56225
|
+
handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);
|
|
56226
|
+
}
|
|
56227
|
+
}
|
|
56228
|
+
}
|
|
56195
56229
|
}
|
|
56196
56230
|
function handleFeatureTableProperties(scenegraph, featureTable, schemaClass) {
|
|
56197
56231
|
for (const propertyName in schemaClass.properties) {
|
|
@@ -56204,19 +56238,128 @@ function handleFeatureTableProperties(scenegraph, featureTable, schemaClass) {
|
|
|
56204
56238
|
}
|
|
56205
56239
|
}
|
|
56206
56240
|
}
|
|
56241
|
+
function handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass) {
|
|
56242
|
+
const attributeName = featureTexture.class;
|
|
56243
|
+
for (const propertyName in schemaClass.properties) {
|
|
56244
|
+
const featureTextureProperty = featureTexture?.properties?.[propertyName];
|
|
56245
|
+
if (featureTextureProperty) {
|
|
56246
|
+
const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);
|
|
56247
|
+
featureTextureProperty.data = data;
|
|
56248
|
+
}
|
|
56249
|
+
}
|
|
56250
|
+
}
|
|
56207
56251
|
function getPropertyDataFromBinarySource(scenegraph, schemaProperty, numberOfFeatures, featureTableProperty) {
|
|
56208
56252
|
const bufferView = featureTableProperty.bufferView;
|
|
56209
|
-
|
|
56253
|
+
const dataArray = scenegraph.getTypedArrayForBufferView(bufferView);
|
|
56210
56254
|
switch (schemaProperty.type) {
|
|
56211
56255
|
case "STRING": {
|
|
56212
56256
|
const stringOffsetBufferView = featureTableProperty.stringOffsetBufferView;
|
|
56213
56257
|
const offsetsData = scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);
|
|
56214
|
-
|
|
56215
|
-
break;
|
|
56258
|
+
return getStringAttributes(dataArray, offsetsData, numberOfFeatures);
|
|
56216
56259
|
}
|
|
56217
56260
|
default:
|
|
56218
56261
|
}
|
|
56219
|
-
return
|
|
56262
|
+
return dataArray;
|
|
56263
|
+
}
|
|
56264
|
+
function getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName) {
|
|
56265
|
+
const json = scenegraph.gltf.json;
|
|
56266
|
+
if (!json.meshes) {
|
|
56267
|
+
return [];
|
|
56268
|
+
}
|
|
56269
|
+
const featureTextureTable = [];
|
|
56270
|
+
for (const mesh of json.meshes) {
|
|
56271
|
+
for (const primitive of mesh.primitives) {
|
|
56272
|
+
processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive);
|
|
56273
|
+
}
|
|
56274
|
+
}
|
|
56275
|
+
return featureTextureTable;
|
|
56276
|
+
}
|
|
56277
|
+
function processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive) {
|
|
56278
|
+
const json = scenegraph.gltf.json;
|
|
56279
|
+
const textureData = [];
|
|
56280
|
+
const texCoordAccessorKey = `TEXCOORD_${featureTextureProperty.texture.texCoord}`;
|
|
56281
|
+
const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];
|
|
56282
|
+
const texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);
|
|
56283
|
+
const texCoordArray = scenegraph.getTypedArrayForBufferView(texCoordBufferView);
|
|
56284
|
+
const textureCoordinates = new Float32Array(texCoordArray.buffer, texCoordArray.byteOffset, texCoordArray.length / 4);
|
|
56285
|
+
const textureIndex = featureTextureProperty.texture.index;
|
|
56286
|
+
const texture = json.textures?.[textureIndex];
|
|
56287
|
+
const imageIndex = texture?.source;
|
|
56288
|
+
if (typeof imageIndex !== "undefined") {
|
|
56289
|
+
const image = json.images?.[imageIndex];
|
|
56290
|
+
const mimeType = image?.mimeType;
|
|
56291
|
+
const parsedImage = scenegraph.gltf.images?.[imageIndex];
|
|
56292
|
+
if (parsedImage) {
|
|
56293
|
+
for (let index = 0; index < textureCoordinates.length; index += 2) {
|
|
56294
|
+
const value = getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, featureTextureProperty.channels);
|
|
56295
|
+
textureData.push(value);
|
|
56296
|
+
}
|
|
56297
|
+
}
|
|
56298
|
+
}
|
|
56299
|
+
const featureIndices = [];
|
|
56300
|
+
for (const texelData of textureData) {
|
|
56301
|
+
let index = featureTextureTable.findIndex((item) => item === texelData);
|
|
56302
|
+
if (index === -1) {
|
|
56303
|
+
index = featureTextureTable.push(texelData) - 1;
|
|
56304
|
+
}
|
|
56305
|
+
featureIndices.push(index);
|
|
56306
|
+
}
|
|
56307
|
+
const typedArray = new Uint32Array(featureIndices);
|
|
56308
|
+
const bufferIndex = scenegraph.gltf.buffers.push({
|
|
56309
|
+
arrayBuffer: typedArray.buffer,
|
|
56310
|
+
byteOffset: 0,
|
|
56311
|
+
byteLength: typedArray.byteLength
|
|
56312
|
+
}) - 1;
|
|
56313
|
+
const bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);
|
|
56314
|
+
const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {
|
|
56315
|
+
size: 1,
|
|
56316
|
+
componentType: getComponentTypeFromArray(typedArray),
|
|
56317
|
+
count: typedArray.length
|
|
56318
|
+
});
|
|
56319
|
+
primitive.attributes[attributeName] = accessorIndex;
|
|
56320
|
+
}
|
|
56321
|
+
function getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, channels) {
|
|
56322
|
+
const CHANNELS_MAP = {
|
|
56323
|
+
r: { offset: 0, shift: 0 },
|
|
56324
|
+
g: { offset: 1, shift: 8 },
|
|
56325
|
+
b: { offset: 2, shift: 16 },
|
|
56326
|
+
a: { offset: 3, shift: 24 }
|
|
56327
|
+
};
|
|
56328
|
+
const u = textureCoordinates[index];
|
|
56329
|
+
const v = textureCoordinates[index + 1];
|
|
56330
|
+
let components = 1;
|
|
56331
|
+
if (mimeType && (mimeType.indexOf("image/jpeg") !== -1 || mimeType.indexOf("image/png") !== -1))
|
|
56332
|
+
components = 4;
|
|
56333
|
+
const offset = coordinatesToOffset(u, v, parsedImage, components);
|
|
56334
|
+
let value = 0;
|
|
56335
|
+
for (const c of channels) {
|
|
56336
|
+
const map = CHANNELS_MAP[c];
|
|
56337
|
+
const val = getVal(parsedImage, offset + map.offset);
|
|
56338
|
+
value |= val << map.shift;
|
|
56339
|
+
}
|
|
56340
|
+
return value;
|
|
56341
|
+
}
|
|
56342
|
+
function getVal(parsedImage, offset) {
|
|
56343
|
+
const imageData = getImageData(parsedImage);
|
|
56344
|
+
if (imageData.data.length <= offset) {
|
|
56345
|
+
throw new Error(`${imageData.data.length} <= ${offset}`);
|
|
56346
|
+
}
|
|
56347
|
+
return imageData.data[offset];
|
|
56348
|
+
}
|
|
56349
|
+
function coordinatesToOffset(u, v, parsedImage, componentsCount = 1) {
|
|
56350
|
+
const w = parsedImage.width;
|
|
56351
|
+
const iX = emod(u) * (w - 1);
|
|
56352
|
+
const indX = Math.round(iX);
|
|
56353
|
+
const h = parsedImage.height;
|
|
56354
|
+
const iY = emod(v) * (h - 1);
|
|
56355
|
+
const indY = Math.round(iY);
|
|
56356
|
+
const components = parsedImage.components ? parsedImage.components : componentsCount;
|
|
56357
|
+
const offset = (indY * w + indX) * components;
|
|
56358
|
+
return offset;
|
|
56359
|
+
}
|
|
56360
|
+
function emod(n) {
|
|
56361
|
+
const a = (n % 1 + 1) % 1;
|
|
56362
|
+
return a;
|
|
56220
56363
|
}
|
|
56221
56364
|
function findFeatureTableByName(featureTables, schemaClassName) {
|
|
56222
56365
|
for (const featureTableName in featureTables) {
|
|
@@ -56227,6 +56370,15 @@ function findFeatureTableByName(featureTables, schemaClassName) {
|
|
|
56227
56370
|
}
|
|
56228
56371
|
return null;
|
|
56229
56372
|
}
|
|
56373
|
+
function findFeatureTextureByName(featureTextures, schemaClassName) {
|
|
56374
|
+
for (const featureTexturesName in featureTextures) {
|
|
56375
|
+
const featureTable = featureTextures[featureTexturesName];
|
|
56376
|
+
if (featureTable.class === schemaClassName) {
|
|
56377
|
+
return featureTable;
|
|
56378
|
+
}
|
|
56379
|
+
}
|
|
56380
|
+
return null;
|
|
56381
|
+
}
|
|
56230
56382
|
function getStringAttributes(data, offsetsData, stringsCount) {
|
|
56231
56383
|
const stringsArray = [];
|
|
56232
56384
|
const textDecoder = new TextDecoder("utf8");
|
|
@@ -56489,17 +56641,13 @@ async function parseGLTF(gltf, arrayBufferOrString, byteOffset = 0, options, con
|
|
|
56489
56641
|
parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);
|
|
56490
56642
|
normalizeGLTFV1(gltf, { normalize: options?.gltf?.normalize });
|
|
56491
56643
|
preprocessExtensions(gltf, options, context);
|
|
56492
|
-
const promises = [];
|
|
56493
56644
|
if (options?.gltf?.loadBuffers && gltf.json.buffers) {
|
|
56494
56645
|
await loadBuffers(gltf, options, context);
|
|
56495
56646
|
}
|
|
56496
56647
|
if (options?.gltf?.loadImages) {
|
|
56497
|
-
|
|
56498
|
-
promises.push(promise2);
|
|
56648
|
+
await loadImages(gltf, options, context);
|
|
56499
56649
|
}
|
|
56500
|
-
|
|
56501
|
-
promises.push(promise);
|
|
56502
|
-
await Promise.all(promises);
|
|
56650
|
+
await decodeExtensions(gltf, options, context);
|
|
56503
56651
|
return gltf;
|
|
56504
56652
|
}
|
|
56505
56653
|
function parseGLTFContainerSync(gltf, data, byteOffset, options) {
|
|
@@ -57022,11 +57170,11 @@ var GLTF_FORMAT = {
|
|
|
57022
57170
|
};
|
|
57023
57171
|
function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {
|
|
57024
57172
|
tile.rotateYtoZ = true;
|
|
57025
|
-
const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;
|
|
57173
|
+
const gltfByteLength = (tile.byteOffset || 0) + (tile.byteLength || 0) - byteOffset;
|
|
57026
57174
|
if (gltfByteLength === 0) {
|
|
57027
57175
|
throw new Error("glTF byte length must be greater than 0.");
|
|
57028
57176
|
}
|
|
57029
|
-
tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
|
|
57177
|
+
tile.gltfUpAxis = options?.["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
|
|
57030
57178
|
tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);
|
|
57031
57179
|
tile.gltfByteOffset = 0;
|
|
57032
57180
|
tile.gltfByteLength = gltfByteLength;
|
|
@@ -57034,15 +57182,19 @@ function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {
|
|
|
57034
57182
|
} else {
|
|
57035
57183
|
console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);
|
|
57036
57184
|
}
|
|
57037
|
-
return tile.byteOffset + tile.byteLength;
|
|
57185
|
+
return (tile.byteOffset || 0) + (tile.byteLength || 0);
|
|
57038
57186
|
}
|
|
57039
57187
|
async function extractGLTF(tile, gltfFormat, options, context) {
|
|
57040
|
-
const tile3DOptions = options["3d-tiles"] || {};
|
|
57188
|
+
const tile3DOptions = options?.["3d-tiles"] || {};
|
|
57041
57189
|
extractGLTFBufferOrURL(tile, gltfFormat, options);
|
|
57042
57190
|
if (tile3DOptions.loadGLTF) {
|
|
57191
|
+
if (!context) {
|
|
57192
|
+
return;
|
|
57193
|
+
}
|
|
57043
57194
|
const { parse: parse7, fetch: fetch2 } = context;
|
|
57044
57195
|
if (tile.gltfUrl) {
|
|
57045
|
-
|
|
57196
|
+
const response = await fetch2(tile.gltfUrl, options);
|
|
57197
|
+
tile.gltfArrayBuffer = await response.arrayBuffer();
|
|
57046
57198
|
tile.gltfByteOffset = 0;
|
|
57047
57199
|
}
|
|
57048
57200
|
if (tile.gltfArrayBuffer) {
|
|
@@ -57058,10 +57210,12 @@ async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
57058
57210
|
function extractGLTFBufferOrURL(tile, gltfFormat, options) {
|
|
57059
57211
|
switch (gltfFormat) {
|
|
57060
57212
|
case GLTF_FORMAT.URI:
|
|
57061
|
-
|
|
57062
|
-
|
|
57063
|
-
|
|
57064
|
-
|
|
57213
|
+
if (tile.gltfArrayBuffer) {
|
|
57214
|
+
const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);
|
|
57215
|
+
const textDecoder = new TextDecoder();
|
|
57216
|
+
const gltfUrl = textDecoder.decode(gltfUrlBytes);
|
|
57217
|
+
tile.gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
|
|
57218
|
+
}
|
|
57065
57219
|
delete tile.gltfArrayBuffer;
|
|
57066
57220
|
delete tile.gltfByteOffset;
|
|
57067
57221
|
delete tile.gltfByteLength;
|
|
@@ -57098,7 +57252,7 @@ var import_core16 = __toModule(require_es5());
|
|
|
57098
57252
|
var import_geospatial7 = __toModule(require_es52());
|
|
57099
57253
|
async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
57100
57254
|
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
|
|
57101
|
-
await extractGLTF(tile, tile.gltfFormat, options, context);
|
|
57255
|
+
await extractGLTF(tile, tile.gltfFormat || 0, options, context);
|
|
57102
57256
|
return byteOffset;
|
|
57103
57257
|
}
|
|
57104
57258
|
function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
@@ -57112,7 +57266,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
|
57112
57266
|
byteOffset += 4;
|
|
57113
57267
|
byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);
|
|
57114
57268
|
byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);
|
|
57115
|
-
if (tile.featureTableJsonByteLength === 0) {
|
|
57269
|
+
if (!tile?.header?.featureTableJsonByteLength || tile.header.featureTableJsonByteLength === 0) {
|
|
57116
57270
|
throw new Error("i3dm parser: featureTableJsonByteLength is zero.");
|
|
57117
57271
|
}
|
|
57118
57272
|
const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);
|
|
@@ -57128,17 +57282,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
|
57128
57282
|
return byteOffset;
|
|
57129
57283
|
}
|
|
57130
57284
|
function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
|
|
57131
|
-
const
|
|
57132
|
-
instances: new Array(instancesLength),
|
|
57133
|
-
batchTable: tile._batchTable,
|
|
57134
|
-
cull: false,
|
|
57135
|
-
url: void 0,
|
|
57136
|
-
gltf: void 0,
|
|
57137
|
-
basePath: void 0,
|
|
57138
|
-
incrementallyLoadTextures: false,
|
|
57139
|
-
forwardAxis: [1, 0, 0]
|
|
57140
|
-
};
|
|
57141
|
-
const instances = collectionOptions.instances;
|
|
57285
|
+
const instances = new Array(instancesLength);
|
|
57142
57286
|
const instancePosition = new import_core16.Vector3();
|
|
57143
57287
|
const instanceNormalRight = new import_core16.Vector3();
|
|
57144
57288
|
const instanceNormalUp = new import_core16.Vector3();
|
|
@@ -57150,19 +57294,19 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
57150
57294
|
const instanceTransform = new import_core16.Matrix4();
|
|
57151
57295
|
const scratch1 = [];
|
|
57152
57296
|
const scratch2 = [];
|
|
57153
|
-
const
|
|
57154
|
-
const
|
|
57297
|
+
const scratch3 = [];
|
|
57298
|
+
const scratch4 = [];
|
|
57155
57299
|
for (let i = 0; i < instancesLength; i++) {
|
|
57156
57300
|
let position;
|
|
57157
57301
|
if (featureTable.hasProperty("POSITION")) {
|
|
57158
57302
|
position = featureTable.getProperty("POSITION", GL2.FLOAT, 3, i, instancePosition);
|
|
57159
57303
|
} else if (featureTable.hasProperty("POSITION_QUANTIZED")) {
|
|
57160
57304
|
position = featureTable.getProperty("POSITION_QUANTIZED", GL2.UNSIGNED_SHORT, 3, i, instancePosition);
|
|
57161
|
-
const quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", GL2.FLOAT, 3
|
|
57305
|
+
const quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", GL2.FLOAT, 3);
|
|
57162
57306
|
if (!quantizedVolumeOffset) {
|
|
57163
57307
|
throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
|
|
57164
57308
|
}
|
|
57165
|
-
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3
|
|
57309
|
+
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3);
|
|
57166
57310
|
if (!quantizedVolumeScale) {
|
|
57167
57311
|
throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
|
|
57168
57312
|
}
|
|
@@ -57185,8 +57329,8 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
57185
57329
|
}
|
|
57186
57330
|
tile.hasCustomOrientation = true;
|
|
57187
57331
|
} else {
|
|
57188
|
-
tile.octNormalUp = featureTable.getProperty("NORMAL_UP_OCT32P", GL2.UNSIGNED_SHORT, 2, scratch1);
|
|
57189
|
-
tile.octNormalRight = featureTable.getProperty("NORMAL_RIGHT_OCT32P", GL2.UNSIGNED_SHORT, 2, scratch2);
|
|
57332
|
+
tile.octNormalUp = featureTable.getProperty("NORMAL_UP_OCT32P", GL2.UNSIGNED_SHORT, 2, i, scratch1);
|
|
57333
|
+
tile.octNormalRight = featureTable.getProperty("NORMAL_RIGHT_OCT32P", GL2.UNSIGNED_SHORT, 2, i, scratch2);
|
|
57190
57334
|
if (tile.octNormalUp) {
|
|
57191
57335
|
if (!tile.octNormalRight) {
|
|
57192
57336
|
throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");
|
|
@@ -57208,7 +57352,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
57208
57352
|
instanceQuaternion.fromMatrix3(instanceRotation);
|
|
57209
57353
|
instanceTranslationRotationScale.rotation = instanceQuaternion;
|
|
57210
57354
|
instanceScale.set(1, 1, 1);
|
|
57211
|
-
const scale = featureTable.getProperty("SCALE", GL2.FLOAT, 1, i);
|
|
57355
|
+
const scale = featureTable.getProperty("SCALE", GL2.FLOAT, 1, i, scratch3);
|
|
57212
57356
|
if (Number.isFinite(scale)) {
|
|
57213
57357
|
instanceScale.multiplyByScalar(scale);
|
|
57214
57358
|
}
|
|
@@ -57217,7 +57361,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
57217
57361
|
instanceScale.scale(nonUniformScale);
|
|
57218
57362
|
}
|
|
57219
57363
|
instanceTranslationRotationScale.scale = instanceScale;
|
|
57220
|
-
let batchId = featureTable.getProperty("BATCH_ID", GL2.UNSIGNED_SHORT, 1, i);
|
|
57364
|
+
let batchId = featureTable.getProperty("BATCH_ID", GL2.UNSIGNED_SHORT, 1, i, scratch4);
|
|
57221
57365
|
if (batchId === void 0) {
|
|
57222
57366
|
batchId = i;
|
|
57223
57367
|
}
|
|
@@ -57242,7 +57386,7 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
|
|
|
57242
57386
|
tile.tilesLength = view.getUint32(byteOffset, true);
|
|
57243
57387
|
byteOffset += 4;
|
|
57244
57388
|
tile.tiles = [];
|
|
57245
|
-
while (tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12) {
|
|
57389
|
+
while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {
|
|
57246
57390
|
const subtile = {};
|
|
57247
57391
|
tile.tiles.push(subtile);
|
|
57248
57392
|
byteOffset = await parse3DTile2(arrayBuffer, byteOffset, options, context, subtile);
|
|
@@ -57253,11 +57397,18 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
|
|
|
57253
57397
|
// ../3d-tiles/src/lib/parsers/parse-3d-tile-gltf.ts
|
|
57254
57398
|
async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
57255
57399
|
tile.rotateYtoZ = true;
|
|
57256
|
-
tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
|
|
57257
|
-
|
|
57258
|
-
|
|
57259
|
-
|
|
57260
|
-
|
|
57400
|
+
tile.gltfUpAxis = options?.["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
|
|
57401
|
+
if (options?.["3d-tiles"]?.loadGLTF) {
|
|
57402
|
+
if (!context) {
|
|
57403
|
+
return;
|
|
57404
|
+
}
|
|
57405
|
+
const { parse: parse7 } = context;
|
|
57406
|
+
const gltfWithBuffers = await parse7(arrayBuffer, GLTFLoader, options, context);
|
|
57407
|
+
tile.gltf = postProcessGLTF(gltfWithBuffers);
|
|
57408
|
+
tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
|
|
57409
|
+
} else {
|
|
57410
|
+
tile.gltfArrayBuffer = arrayBuffer;
|
|
57411
|
+
}
|
|
57261
57412
|
}
|
|
57262
57413
|
|
|
57263
57414
|
// ../3d-tiles/src/lib/parsers/parse-3d-tile.ts
|
|
@@ -58735,11 +58886,11 @@ function getBooleanValueFromBitstream(availabilityIndex, availabilityBuffer) {
|
|
|
58735
58886
|
}
|
|
58736
58887
|
|
|
58737
58888
|
// ../3d-tiles/src/lib/parsers/parse-3d-tile-header.ts
|
|
58738
|
-
function getTileType(tile) {
|
|
58739
|
-
if (!
|
|
58889
|
+
function getTileType(tile, tileContentUrl = "") {
|
|
58890
|
+
if (!tileContentUrl) {
|
|
58740
58891
|
return TILE_TYPE.EMPTY;
|
|
58741
58892
|
}
|
|
58742
|
-
const contentUrl =
|
|
58893
|
+
const contentUrl = tileContentUrl.split("?")[0];
|
|
58743
58894
|
const fileExtension = contentUrl.split(".").pop();
|
|
58744
58895
|
switch (fileExtension) {
|
|
58745
58896
|
case "pnts":
|
|
@@ -58750,7 +58901,7 @@ function getTileType(tile) {
|
|
|
58750
58901
|
case "gltf":
|
|
58751
58902
|
return TILE_TYPE.SCENEGRAPH;
|
|
58752
58903
|
default:
|
|
58753
|
-
return fileExtension;
|
|
58904
|
+
return fileExtension || TILE_TYPE.EMPTY;
|
|
58754
58905
|
}
|
|
58755
58906
|
}
|
|
58756
58907
|
function getRefine(refine) {
|
|
@@ -58765,7 +58916,7 @@ function getRefine(refine) {
|
|
|
58765
58916
|
return refine;
|
|
58766
58917
|
}
|
|
58767
58918
|
}
|
|
58768
|
-
function resolveUri(uri, basePath) {
|
|
58919
|
+
function resolveUri(uri = "", basePath) {
|
|
58769
58920
|
const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;
|
|
58770
58921
|
if (urlSchemeRegex.test(basePath)) {
|
|
58771
58922
|
const url = new URL(uri, `${basePath}/`);
|
|
@@ -58775,50 +58926,59 @@ function resolveUri(uri, basePath) {
|
|
|
58775
58926
|
}
|
|
58776
58927
|
return `${basePath}/${uri}`;
|
|
58777
58928
|
}
|
|
58778
|
-
function normalizeTileData(tile,
|
|
58929
|
+
function normalizeTileData(tile, basePath) {
|
|
58779
58930
|
if (!tile) {
|
|
58780
58931
|
return null;
|
|
58781
58932
|
}
|
|
58933
|
+
let tileContentUrl;
|
|
58782
58934
|
if (tile.content) {
|
|
58783
|
-
const contentUri = tile.content.uri || tile.content
|
|
58784
|
-
|
|
58785
|
-
}
|
|
58786
|
-
|
|
58787
|
-
|
|
58788
|
-
|
|
58789
|
-
|
|
58790
|
-
|
|
58791
|
-
|
|
58792
|
-
|
|
58935
|
+
const contentUri = tile.content.uri || tile.content?.url;
|
|
58936
|
+
tileContentUrl = resolveUri(contentUri, basePath);
|
|
58937
|
+
}
|
|
58938
|
+
const tilePostprocessed = {
|
|
58939
|
+
...tile,
|
|
58940
|
+
id: tileContentUrl,
|
|
58941
|
+
contentUrl: tileContentUrl,
|
|
58942
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
58943
|
+
lodMetricValue: tile.geometricError,
|
|
58944
|
+
transformMatrix: tile.transform,
|
|
58945
|
+
type: getTileType(tile, tileContentUrl),
|
|
58946
|
+
refine: getRefine(tile.refine)
|
|
58947
|
+
};
|
|
58948
|
+
return tilePostprocessed;
|
|
58793
58949
|
}
|
|
58794
|
-
async function normalizeTileHeaders(tileset, options) {
|
|
58795
|
-
|
|
58796
|
-
|
|
58797
|
-
const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset?.root);
|
|
58950
|
+
async function normalizeTileHeaders(tileset, basePath, options) {
|
|
58951
|
+
let root = null;
|
|
58952
|
+
const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);
|
|
58798
58953
|
if (rootImplicitTilingExtension && tileset.root) {
|
|
58799
|
-
root = await normalizeImplicitTileHeaders(tileset.root, tileset, rootImplicitTilingExtension, options);
|
|
58954
|
+
root = await normalizeImplicitTileHeaders(tileset.root, tileset, basePath, rootImplicitTilingExtension, options);
|
|
58800
58955
|
} else {
|
|
58801
|
-
root = normalizeTileData(tileset.root,
|
|
58956
|
+
root = normalizeTileData(tileset.root, basePath);
|
|
58802
58957
|
}
|
|
58803
58958
|
const stack2 = [];
|
|
58804
58959
|
stack2.push(root);
|
|
58805
58960
|
while (stack2.length > 0) {
|
|
58806
58961
|
const tile = stack2.pop() || {};
|
|
58807
58962
|
const children = tile.children || [];
|
|
58808
|
-
|
|
58963
|
+
const childrenPostprocessed = [];
|
|
58964
|
+
for (const childHeader of children) {
|
|
58809
58965
|
const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
|
|
58966
|
+
let childHeaderPostprocessed;
|
|
58810
58967
|
if (childImplicitTilingExtension) {
|
|
58811
|
-
|
|
58968
|
+
childHeaderPostprocessed = await normalizeImplicitTileHeaders(childHeader, tileset, basePath, childImplicitTilingExtension, options);
|
|
58812
58969
|
} else {
|
|
58813
|
-
normalizeTileData(childHeader,
|
|
58970
|
+
childHeaderPostprocessed = normalizeTileData(childHeader, basePath);
|
|
58971
|
+
}
|
|
58972
|
+
if (childHeaderPostprocessed) {
|
|
58973
|
+
childrenPostprocessed.push(childHeaderPostprocessed);
|
|
58974
|
+
stack2.push(childHeaderPostprocessed);
|
|
58814
58975
|
}
|
|
58815
|
-
stack2.push(childHeader);
|
|
58816
58976
|
}
|
|
58977
|
+
tile.children = childrenPostprocessed;
|
|
58817
58978
|
}
|
|
58818
58979
|
return root;
|
|
58819
58980
|
}
|
|
58820
|
-
async function normalizeImplicitTileHeaders(tile, tileset, implicitTilingExtension, options) {
|
|
58821
|
-
const basePath = tileset.basePath;
|
|
58981
|
+
async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTilingExtension, options) {
|
|
58822
58982
|
const {
|
|
58823
58983
|
subdivisionScheme,
|
|
58824
58984
|
maximumLevel,
|
|
@@ -58828,7 +58988,7 @@ async function normalizeImplicitTileHeaders(tile, tileset, implicitTilingExtensi
|
|
|
58828
58988
|
const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
58829
58989
|
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
58830
58990
|
const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);
|
|
58831
|
-
const contentUrlTemplate = resolveUri(tile.content
|
|
58991
|
+
const contentUrlTemplate = resolveUri(tile.content?.uri, basePath);
|
|
58832
58992
|
const refine = tileset?.root?.refine;
|
|
58833
58993
|
const rootLodMetricValue = tile.geometricError;
|
|
58834
58994
|
const s2VolumeInfo = tile.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];
|
|
@@ -58852,29 +59012,35 @@ async function normalizeImplicitTileHeaders(tile, tileset, implicitTilingExtensi
|
|
|
58852
59012
|
getTileType,
|
|
58853
59013
|
getRefine
|
|
58854
59014
|
};
|
|
58855
|
-
return await normalizeImplicitTileData(tile, subtree, implicitOptions);
|
|
59015
|
+
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
|
|
58856
59016
|
}
|
|
58857
|
-
async function normalizeImplicitTileData(tile, rootSubtree, options) {
|
|
59017
|
+
async function normalizeImplicitTileData(tile, basePath, rootSubtree, options) {
|
|
58858
59018
|
if (!tile) {
|
|
58859
59019
|
return null;
|
|
58860
59020
|
}
|
|
58861
|
-
tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
58862
|
-
tile.lodMetricValue = tile.geometricError;
|
|
58863
|
-
tile.transformMatrix = tile.transform;
|
|
58864
59021
|
const { children, contentUrl } = await parseImplicitTiles({
|
|
58865
59022
|
subtree: rootSubtree,
|
|
58866
|
-
options
|
|
58867
|
-
s2VolumeBox: tile
|
|
59023
|
+
options
|
|
58868
59024
|
});
|
|
59025
|
+
let tileContentUrl;
|
|
59026
|
+
let tileContent = null;
|
|
58869
59027
|
if (contentUrl) {
|
|
58870
|
-
|
|
58871
|
-
|
|
59028
|
+
tileContentUrl = contentUrl;
|
|
59029
|
+
tileContent = { uri: contentUrl.replace(`${basePath}/`, "") };
|
|
58872
59030
|
}
|
|
58873
|
-
|
|
58874
|
-
|
|
58875
|
-
|
|
58876
|
-
|
|
58877
|
-
|
|
59031
|
+
const tilePostprocessed = {
|
|
59032
|
+
...tile,
|
|
59033
|
+
id: tileContentUrl,
|
|
59034
|
+
contentUrl: tileContentUrl,
|
|
59035
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
59036
|
+
lodMetricValue: tile.geometricError,
|
|
59037
|
+
transformMatrix: tile.transform,
|
|
59038
|
+
type: getTileType(tile, tileContentUrl),
|
|
59039
|
+
refine: getRefine(tile.refine),
|
|
59040
|
+
content: tileContent || tile.content,
|
|
59041
|
+
children
|
|
59042
|
+
};
|
|
59043
|
+
return tilePostprocessed;
|
|
58878
59044
|
}
|
|
58879
59045
|
function getImplicitTilingExtensionData(tile) {
|
|
58880
59046
|
return tile?.extensions?.["3DTILES_implicit_tiling"] || tile?.implicitTiling;
|
|
@@ -58907,19 +59073,25 @@ async function parse4(data, options = {}, context) {
|
|
|
58907
59073
|
} else {
|
|
58908
59074
|
isTileset = loaderOptions.isTileset;
|
|
58909
59075
|
}
|
|
58910
|
-
return
|
|
59076
|
+
return isTileset ? parseTileset(data, options, context) : parseTile(data, options, context);
|
|
58911
59077
|
}
|
|
58912
59078
|
async function parseTileset(data, options, context) {
|
|
58913
59079
|
const tilesetJson = JSON.parse(new TextDecoder().decode(data));
|
|
58914
|
-
|
|
58915
|
-
|
|
58916
|
-
|
|
58917
|
-
|
|
58918
|
-
|
|
58919
|
-
|
|
58920
|
-
|
|
58921
|
-
|
|
58922
|
-
|
|
59080
|
+
const tilesetUrl = context?.url || "";
|
|
59081
|
+
const basePath = getBaseUri(tilesetUrl);
|
|
59082
|
+
const normalizedRoot = await normalizeTileHeaders(tilesetJson, basePath, options || {});
|
|
59083
|
+
const tilesetJsonPostprocessed = {
|
|
59084
|
+
...tilesetJson,
|
|
59085
|
+
loader: Tiles3DLoader,
|
|
59086
|
+
url: tilesetUrl,
|
|
59087
|
+
queryString: context?.queryString || "",
|
|
59088
|
+
basePath,
|
|
59089
|
+
root: normalizedRoot || tilesetJson.root,
|
|
59090
|
+
type: TILESET_TYPE.TILES3D,
|
|
59091
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
59092
|
+
lodMetricValue: tilesetJson.root?.geometricError || 0
|
|
59093
|
+
};
|
|
59094
|
+
return tilesetJsonPostprocessed;
|
|
58923
59095
|
}
|
|
58924
59096
|
async function parseTile(arrayBuffer, options, context) {
|
|
58925
59097
|
const tile = {
|
|
@@ -58931,8 +59103,8 @@ async function parseTile(arrayBuffer, options, context) {
|
|
|
58931
59103
|
await parse3DTile(arrayBuffer, byteOffset, options, context, tile.content);
|
|
58932
59104
|
return tile.content;
|
|
58933
59105
|
}
|
|
58934
|
-
function getBaseUri(
|
|
58935
|
-
return path_exports.dirname(
|
|
59106
|
+
function getBaseUri(tilesetUrl) {
|
|
59107
|
+
return path_exports.dirname(tilesetUrl);
|
|
58936
59108
|
}
|
|
58937
59109
|
|
|
58938
59110
|
// ../3d-tiles/src/lib/ion/ion.ts
|
|
@@ -59193,7 +59365,7 @@ async function isFileExists(fileName) {
|
|
|
59193
59365
|
}
|
|
59194
59366
|
}
|
|
59195
59367
|
function removeDir(path2) {
|
|
59196
|
-
return import_fs3.promises.
|
|
59368
|
+
return import_fs3.promises.rm(path2, { recursive: true });
|
|
59197
59369
|
}
|
|
59198
59370
|
function removeFile(path2) {
|
|
59199
59371
|
return import_fs3.promises.unlink(path2);
|
|
@@ -59440,8 +59612,8 @@ async function getTotalFilesSize(dirPath) {
|
|
|
59440
59612
|
}
|
|
59441
59613
|
|
|
59442
59614
|
// src/i3s-converter/helpers/geometry-converter.ts
|
|
59443
|
-
var
|
|
59444
|
-
var
|
|
59615
|
+
var import_core25 = __toModule(require_es5());
|
|
59616
|
+
var import_geospatial11 = __toModule(require_es52());
|
|
59445
59617
|
var import_md5 = __toModule(require_md52());
|
|
59446
59618
|
|
|
59447
59619
|
// src/i3s-converter/helpers/geometry-attributes.ts
|
|
@@ -59615,19 +59787,18 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
|
|
|
59615
59787
|
var import_core23 = __toModule(require_es5());
|
|
59616
59788
|
var import_geospatial9 = __toModule(require_es52());
|
|
59617
59789
|
var import_culling6 = __toModule(require_es53());
|
|
59618
|
-
function createBoundingVolumes(
|
|
59790
|
+
function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
59619
59791
|
let radius;
|
|
59620
59792
|
let halfSize;
|
|
59621
59793
|
let quaternion;
|
|
59622
|
-
const
|
|
59623
|
-
const cartographicCenter = import_geospatial9.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core23.Vector3());
|
|
59794
|
+
const cartographicCenter = import_geospatial9.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new import_core23.Vector3());
|
|
59624
59795
|
cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
59625
|
-
if (
|
|
59626
|
-
halfSize =
|
|
59796
|
+
if (sourceBoundingVolume instanceof import_culling6.OrientedBoundingBox) {
|
|
59797
|
+
halfSize = sourceBoundingVolume.halfSize;
|
|
59627
59798
|
radius = new import_core23.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
59628
|
-
quaternion =
|
|
59799
|
+
quaternion = sourceBoundingVolume.quaternion;
|
|
59629
59800
|
} else {
|
|
59630
|
-
radius =
|
|
59801
|
+
radius = sourceBoundingVolume.radius;
|
|
59631
59802
|
halfSize = [radius, radius, radius];
|
|
59632
59803
|
quaternion = new import_core23.Quaternion().fromMatrix3(new import_core23.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
|
|
59633
59804
|
}
|
|
@@ -59693,16 +59864,9 @@ function createObbFromMbs(mbs) {
|
|
|
59693
59864
|
}
|
|
59694
59865
|
|
|
59695
59866
|
// src/i3s-converter/helpers/gltf-attributes.ts
|
|
59696
|
-
|
|
59697
|
-
|
|
59698
|
-
|
|
59699
|
-
attributesWithoutBufferView[attributeName] = {
|
|
59700
|
-
value: attributes[attributeName].value
|
|
59701
|
-
};
|
|
59702
|
-
}
|
|
59703
|
-
return attributesWithoutBufferView;
|
|
59704
|
-
}
|
|
59705
|
-
function prepareDataForAttributesConversion(tileContent) {
|
|
59867
|
+
var import_core24 = __toModule(require_es5());
|
|
59868
|
+
var import_geospatial10 = __toModule(require_es52());
|
|
59869
|
+
function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
|
|
59706
59870
|
let nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
|
|
59707
59871
|
const images = tileContent.gltf?.images?.map((imageObject) => {
|
|
59708
59872
|
if (imageObject?.image?.compressed) {
|
|
@@ -59722,8 +59886,7 @@ function prepareDataForAttributesConversion(tileContent) {
|
|
|
59722
59886
|
}
|
|
59723
59887
|
}) || [];
|
|
59724
59888
|
prepareNodes(nodes);
|
|
59725
|
-
const cartographicOrigin = tileContent
|
|
59726
|
-
const cartesianModelMatrix = tileContent.cartesianModelMatrix;
|
|
59889
|
+
const { cartographicOrigin, modelMatrix: cartesianModelMatrix } = calculateTransformProps2(tileContent, tileTransform, boundingVolume);
|
|
59727
59890
|
return {
|
|
59728
59891
|
nodes,
|
|
59729
59892
|
images,
|
|
@@ -59731,6 +59894,40 @@ function prepareDataForAttributesConversion(tileContent) {
|
|
|
59731
59894
|
cartesianModelMatrix
|
|
59732
59895
|
};
|
|
59733
59896
|
}
|
|
59897
|
+
function getB3DMAttributesWithoutBufferView(attributes) {
|
|
59898
|
+
const attributesWithoutBufferView = {};
|
|
59899
|
+
for (const attributeName in attributes) {
|
|
59900
|
+
attributesWithoutBufferView[attributeName] = {
|
|
59901
|
+
value: attributes[attributeName].value
|
|
59902
|
+
};
|
|
59903
|
+
}
|
|
59904
|
+
return attributesWithoutBufferView;
|
|
59905
|
+
}
|
|
59906
|
+
function calculateTransformProps2(tileContent, tileTransform, boundingVolume) {
|
|
59907
|
+
const { rtcCenter, gltfUpAxis } = tileContent;
|
|
59908
|
+
const { center } = boundingVolume;
|
|
59909
|
+
let modelMatrix = new import_core24.Matrix4(tileTransform);
|
|
59910
|
+
if (rtcCenter) {
|
|
59911
|
+
modelMatrix.translate(rtcCenter);
|
|
59912
|
+
}
|
|
59913
|
+
switch (gltfUpAxis) {
|
|
59914
|
+
case "Z":
|
|
59915
|
+
break;
|
|
59916
|
+
case "Y":
|
|
59917
|
+
const rotationY = new import_core24.Matrix4().rotateX(Math.PI / 2);
|
|
59918
|
+
modelMatrix = modelMatrix.multiplyRight(rotationY);
|
|
59919
|
+
break;
|
|
59920
|
+
case "X":
|
|
59921
|
+
const rotationX = new import_core24.Matrix4().rotateY(-Math.PI / 2);
|
|
59922
|
+
modelMatrix = modelMatrix.multiplyRight(rotationX);
|
|
59923
|
+
break;
|
|
59924
|
+
default:
|
|
59925
|
+
break;
|
|
59926
|
+
}
|
|
59927
|
+
const cartesianOrigin = new import_core24.Vector3(center);
|
|
59928
|
+
const cartographicOrigin = import_geospatial10.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core24.Vector3());
|
|
59929
|
+
return { modelMatrix, cartographicOrigin };
|
|
59930
|
+
}
|
|
59734
59931
|
function prepareNodes(nodes) {
|
|
59735
59932
|
for (let index = 0; index < nodes.length; index++) {
|
|
59736
59933
|
const node2 = nodes[index];
|
|
@@ -59797,8 +59994,8 @@ function handleExtFeatureMetadataExtension(attributes, extFeatureMetadata, image
|
|
|
59797
59994
|
}
|
|
59798
59995
|
const featureTexture = extFeatureMetadata?.featureTextures && extFeatureMetadata?.featureTextures[0];
|
|
59799
59996
|
if (featureTexture) {
|
|
59800
|
-
|
|
59801
|
-
return
|
|
59997
|
+
const batchIdsAttribute = attributes[featureTexture];
|
|
59998
|
+
return batchIdsAttribute.value;
|
|
59802
59999
|
}
|
|
59803
60000
|
return [];
|
|
59804
60001
|
}
|
|
@@ -59842,8 +60039,8 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
|
|
|
59842
60039
|
for (let index = 0; index < textureCoordinates.length; index += 2) {
|
|
59843
60040
|
const u = textureCoordinates[index];
|
|
59844
60041
|
const v = textureCoordinates[index + 1];
|
|
59845
|
-
const tx = Math.min(
|
|
59846
|
-
const ty = Math.min(
|
|
60042
|
+
const tx = Math.min(emod2(u) * image.width | 0, image.width - 1);
|
|
60043
|
+
const ty = Math.min(emod2(v) * image.height | 0, image.height - 1);
|
|
59847
60044
|
const offset = (ty * image.width + tx) * image.components + channels;
|
|
59848
60045
|
const batchId = new Uint8Array(image.data)[offset];
|
|
59849
60046
|
batchIds.push(batchId);
|
|
@@ -59853,7 +60050,7 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
|
|
|
59853
60050
|
}
|
|
59854
60051
|
return batchIds;
|
|
59855
60052
|
}
|
|
59856
|
-
function
|
|
60053
|
+
function emod2(n) {
|
|
59857
60054
|
return (n % 1 + 1) % 1;
|
|
59858
60055
|
}
|
|
59859
60056
|
|
|
@@ -60018,11 +60215,11 @@ var OBJECT_ID_TYPE2 = "Oid32";
|
|
|
60018
60215
|
var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ["CUSTOM_ATTRIBUTE_2", "_BATCHID", "BATCHID"];
|
|
60019
60216
|
var EXT_FEATURE_METADATA3 = "EXT_feature_metadata";
|
|
60020
60217
|
var EXT_MESH_FEATURES2 = "EXT_mesh_features";
|
|
60021
|
-
var scratchVector5 = new
|
|
60022
|
-
async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
|
|
60218
|
+
var scratchVector5 = new import_core25.Vector3();
|
|
60219
|
+
async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
|
|
60023
60220
|
const useCartesianPositions = generateBoundingVolumes;
|
|
60024
60221
|
const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
|
|
60025
|
-
const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent);
|
|
60222
|
+
const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent, tileTransform, tileBoundingVolume);
|
|
60026
60223
|
const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
|
|
60027
60224
|
if (generateBoundingVolumes) {
|
|
60028
60225
|
_generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
|
|
@@ -60064,7 +60261,7 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
60064
60261
|
const cartographicOrigin = boundingVolumes.obb.center;
|
|
60065
60262
|
for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
|
|
60066
60263
|
const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
|
|
60067
|
-
|
|
60264
|
+
import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector5);
|
|
60068
60265
|
scratchVector5[2] = scratchVector5[2] - geoidHeightModel.getHeight(scratchVector5[1], scratchVector5[0]);
|
|
60069
60266
|
scratchVector5 = scratchVector5.subtract(cartographicOrigin);
|
|
60070
60267
|
attributes.positions.set(scratchVector5, index);
|
|
@@ -60156,7 +60353,7 @@ async function convertAttributes(attributesData, materialAndTextureList, useCart
|
|
|
60156
60353
|
}
|
|
60157
60354
|
return attributesMap;
|
|
60158
60355
|
}
|
|
60159
|
-
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new
|
|
60356
|
+
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core25.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
60160
60357
|
if (nodes) {
|
|
60161
60358
|
for (const node2 of nodes) {
|
|
60162
60359
|
convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
|
|
@@ -60180,7 +60377,7 @@ function getCompositeTransformationMatrix(node2, matrix) {
|
|
|
60180
60377
|
}
|
|
60181
60378
|
return transformationMatrix;
|
|
60182
60379
|
}
|
|
60183
|
-
function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new
|
|
60380
|
+
function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core25.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
60184
60381
|
const transformationMatrix = getCompositeTransformationMatrix(node2, matrix);
|
|
60185
60382
|
const mesh = node2.mesh;
|
|
60186
60383
|
if (mesh) {
|
|
@@ -60188,7 +60385,7 @@ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, at
|
|
|
60188
60385
|
}
|
|
60189
60386
|
convertNodes(node2.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
60190
60387
|
}
|
|
60191
|
-
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new
|
|
60388
|
+
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core25.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
60192
60389
|
for (const primitive of mesh.primitives) {
|
|
60193
60390
|
let outputAttributes = null;
|
|
60194
60391
|
let materialUvRegion;
|
|
@@ -60199,7 +60396,7 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
60199
60396
|
outputAttributes = attributesMap.get("default");
|
|
60200
60397
|
}
|
|
60201
60398
|
assert2(outputAttributes !== null, "Primitive - material mapping failed");
|
|
60202
|
-
assert2(primitive.mode === GL2.TRIANGLES || primitive.mode === GL2.TRIANGLE_STRIP, `Primitive - unsupported mode ${primitive.mode}`);
|
|
60399
|
+
assert2(primitive.mode === void 0 || primitive.mode === GL2.TRIANGLES || primitive.mode === GL2.TRIANGLE_STRIP, `Primitive - unsupported mode ${primitive.mode}`);
|
|
60203
60400
|
const attributes = primitive.attributes;
|
|
60204
60401
|
if (!outputAttributes) {
|
|
60205
60402
|
continue;
|
|
@@ -60266,7 +60463,7 @@ function transformVertexArray(args) {
|
|
|
60266
60463
|
for (let i = 0; i < indices.length; i++) {
|
|
60267
60464
|
const coordIndex = indices[i] * VALUES_PER_VERTEX2;
|
|
60268
60465
|
const vertex = vertices.subarray(coordIndex, coordIndex + VALUES_PER_VERTEX2);
|
|
60269
|
-
let vertexVector = new
|
|
60466
|
+
let vertexVector = new import_core25.Vector3(Array.from(vertex));
|
|
60270
60467
|
vertexVector = attributeSpecificTransformation(vertexVector, args);
|
|
60271
60468
|
newVertices[i * VALUES_PER_VERTEX2] = vertexVector.x;
|
|
60272
60469
|
newVertices[i * VALUES_PER_VERTEX2 + 1] = vertexVector.y;
|
|
@@ -60283,7 +60480,7 @@ function transformVertexPositions(vertexVector, calleeArgs) {
|
|
|
60283
60480
|
if (useCartesianPositions) {
|
|
60284
60481
|
return vertexVector;
|
|
60285
60482
|
}
|
|
60286
|
-
|
|
60483
|
+
import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic([vertexVector[0], vertexVector[1], vertexVector[2]], vertexVector);
|
|
60287
60484
|
vertexVector = vertexVector.subtract(cartographicOrigin);
|
|
60288
60485
|
return vertexVector;
|
|
60289
60486
|
}
|
|
@@ -60518,10 +60715,10 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
|
60518
60715
|
}
|
|
60519
60716
|
function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 1) {
|
|
60520
60717
|
const matDielectricColorComponent = 0.04 / 255;
|
|
60521
|
-
const black = new
|
|
60522
|
-
const unitVector = new
|
|
60523
|
-
const dielectricSpecular = new
|
|
60524
|
-
const baseColorVector = new
|
|
60718
|
+
const black = new import_core25.Vector4(0, 0, 0, 1);
|
|
60719
|
+
const unitVector = new import_core25.Vector4(1, 1, 1, 1);
|
|
60720
|
+
const dielectricSpecular = new import_core25.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
|
|
60721
|
+
const baseColorVector = new import_core25.Vector4(baseColorFactor);
|
|
60525
60722
|
const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
|
|
60526
60723
|
const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
|
|
60527
60724
|
dielectricSpecular[3] = 1;
|
|
@@ -60723,6 +60920,9 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
|
|
|
60723
60920
|
return orderedFeatureIndices;
|
|
60724
60921
|
}
|
|
60725
60922
|
function getPropertyTable(tileContent) {
|
|
60923
|
+
if (!tileContent) {
|
|
60924
|
+
return null;
|
|
60925
|
+
}
|
|
60726
60926
|
const batchTableJson = tileContent?.batchTableJson;
|
|
60727
60927
|
if (batchTableJson) {
|
|
60728
60928
|
return batchTableJson;
|
|
@@ -60757,10 +60957,6 @@ function getPropertyTableExtension(tileContent) {
|
|
|
60757
60957
|
return { extensionName, extension };
|
|
60758
60958
|
}
|
|
60759
60959
|
function getPropertyTableFromExtFeatureMetadata(extension) {
|
|
60760
|
-
if (extension?.featureTextures) {
|
|
60761
|
-
console.warn("The I3S converter does not yet support the EXT_feature_metadata feature textures");
|
|
60762
|
-
return null;
|
|
60763
|
-
}
|
|
60764
60960
|
if (extension?.featureTables) {
|
|
60765
60961
|
const firstFeatureTableName = Object.keys(extension.featureTables)?.[0];
|
|
60766
60962
|
if (firstFeatureTableName) {
|
|
@@ -60772,7 +60968,18 @@ function getPropertyTableFromExtFeatureMetadata(extension) {
|
|
|
60772
60968
|
return propertyTable;
|
|
60773
60969
|
}
|
|
60774
60970
|
}
|
|
60775
|
-
|
|
60971
|
+
if (extension?.featureTextures) {
|
|
60972
|
+
const firstTextureName = Object.keys(extension.featureTextures)?.[0];
|
|
60973
|
+
if (firstTextureName) {
|
|
60974
|
+
const featureTable = extension?.featureTextures[firstTextureName];
|
|
60975
|
+
const propertyTable = {};
|
|
60976
|
+
for (const propertyName in featureTable.properties) {
|
|
60977
|
+
propertyTable[propertyName] = featureTable.properties[propertyName].data;
|
|
60978
|
+
}
|
|
60979
|
+
return propertyTable;
|
|
60980
|
+
}
|
|
60981
|
+
}
|
|
60982
|
+
console.warn("The I3S converter couldn't handle EXT_feature_metadata extension: There is neither featureTables, no featureTextures in the extension.");
|
|
60776
60983
|
return null;
|
|
60777
60984
|
}
|
|
60778
60985
|
|
|
@@ -61320,8 +61527,8 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
|
|
|
61320
61527
|
|
|
61321
61528
|
// src/i3s-converter/helpers/node-debug.ts
|
|
61322
61529
|
var import_culling7 = __toModule(require_es53());
|
|
61323
|
-
var
|
|
61324
|
-
var
|
|
61530
|
+
var import_core27 = __toModule(require_es5());
|
|
61531
|
+
var import_geospatial12 = __toModule(require_es52());
|
|
61325
61532
|
var CUBE_POSITIONS = new Float32Array([
|
|
61326
61533
|
-1,
|
|
61327
61534
|
-1,
|
|
@@ -61434,10 +61641,10 @@ function createBoundingBoxFromTileObb(obb) {
|
|
|
61434
61641
|
function getTileObbVertices(node2) {
|
|
61435
61642
|
const halfSize = node2.obb.halfSize;
|
|
61436
61643
|
const positions = CUBE_POSITIONS;
|
|
61437
|
-
const obbCenterCartesian =
|
|
61644
|
+
const obbCenterCartesian = import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(node2.obb.center);
|
|
61438
61645
|
let vertices = [];
|
|
61439
61646
|
for (let i = 0; i < positions.length; i += 3) {
|
|
61440
|
-
const positionsVector = new
|
|
61647
|
+
const positionsVector = new import_core27.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
|
|
61441
61648
|
const rotatedPositions = positionsVector.transformByQuaternion(node2.obb.quaternion).add(obbCenterCartesian);
|
|
61442
61649
|
vertices = vertices.concat(rotatedPositions);
|
|
61443
61650
|
}
|
|
@@ -61447,7 +61654,7 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
|
|
|
61447
61654
|
let isVerticesInsideObb = true;
|
|
61448
61655
|
for (let index = 0; index < positions.length / 3; index += 3) {
|
|
61449
61656
|
const point = [positions[index], positions[index + 1], positions[index + 2]];
|
|
61450
|
-
const cartographicPoint =
|
|
61657
|
+
const cartographicPoint = import_geospatial12.Ellipsoid.WGS84.cartesianToCartographic(point);
|
|
61451
61658
|
const distance = boundingVolume.distanceTo(cartographicPoint);
|
|
61452
61659
|
if (distance > 0) {
|
|
61453
61660
|
isVerticesInsideObb = false;
|
|
@@ -61457,6 +61664,18 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
|
|
|
61457
61664
|
return isVerticesInsideObb;
|
|
61458
61665
|
}
|
|
61459
61666
|
|
|
61667
|
+
// src/i3s-converter/types.ts
|
|
61668
|
+
var GltfPrimitiveModeString;
|
|
61669
|
+
(function(GltfPrimitiveModeString2) {
|
|
61670
|
+
GltfPrimitiveModeString2["POINTS"] = "POINTS";
|
|
61671
|
+
GltfPrimitiveModeString2["LINES"] = "LINES";
|
|
61672
|
+
GltfPrimitiveModeString2["LINE_LOOP"] = "LINE_LOOP";
|
|
61673
|
+
GltfPrimitiveModeString2["LINE_STRIP"] = "LINE_STRIP";
|
|
61674
|
+
GltfPrimitiveModeString2["TRIANGLES"] = "TRIANGLES";
|
|
61675
|
+
GltfPrimitiveModeString2["TRIANGLE_STRIP"] = "TRIANGLE_STRIP";
|
|
61676
|
+
GltfPrimitiveModeString2["TRIANGLE_FAN"] = "TRIANGLE_FAN";
|
|
61677
|
+
})(GltfPrimitiveModeString || (GltfPrimitiveModeString = {}));
|
|
61678
|
+
|
|
61460
61679
|
// src/lib/utils/queue.ts
|
|
61461
61680
|
var Queue = class extends Array {
|
|
61462
61681
|
enqueue(val) {
|
|
@@ -61653,10 +61872,14 @@ var NodeIndexDocument = class {
|
|
|
61653
61872
|
constructor(id, converter) {
|
|
61654
61873
|
this.data = null;
|
|
61655
61874
|
this.children = [];
|
|
61875
|
+
this._finalized = false;
|
|
61656
61876
|
this.inPageId = id;
|
|
61657
61877
|
this.id = id === 0 ? "root" : id.toString();
|
|
61658
61878
|
this.converter = converter;
|
|
61659
61879
|
}
|
|
61880
|
+
get finalized() {
|
|
61881
|
+
return this._finalized;
|
|
61882
|
+
}
|
|
61660
61883
|
async addData(data) {
|
|
61661
61884
|
if (this.converter.options.instantNodeWriting) {
|
|
61662
61885
|
await this.write(data);
|
|
@@ -61690,6 +61913,9 @@ var NodeIndexDocument = class {
|
|
|
61690
61913
|
}
|
|
61691
61914
|
}
|
|
61692
61915
|
async addNeighbors() {
|
|
61916
|
+
if (this.finalized) {
|
|
61917
|
+
return;
|
|
61918
|
+
}
|
|
61693
61919
|
const nodeData = await this.load();
|
|
61694
61920
|
for (const childNode of this.children) {
|
|
61695
61921
|
const childNodeData = await childNode.load();
|
|
@@ -61709,14 +61935,20 @@ var NodeIndexDocument = class {
|
|
|
61709
61935
|
await childNode.write(childNodeData);
|
|
61710
61936
|
}
|
|
61711
61937
|
await childNode.save();
|
|
61712
|
-
childNode.flush();
|
|
61713
61938
|
}
|
|
61939
|
+
this.finalize();
|
|
61714
61940
|
}
|
|
61715
61941
|
async save() {
|
|
61716
61942
|
if (this.data) {
|
|
61717
61943
|
await this.write(this.data);
|
|
61718
61944
|
}
|
|
61719
61945
|
}
|
|
61946
|
+
finalize() {
|
|
61947
|
+
this._finalized = true;
|
|
61948
|
+
for (const child of this.children) {
|
|
61949
|
+
child.flush();
|
|
61950
|
+
}
|
|
61951
|
+
}
|
|
61720
61952
|
async write(node2) {
|
|
61721
61953
|
const path2 = (0, import_path7.join)(this.converter.layers0Path, "nodes", this.id);
|
|
61722
61954
|
if (this.converter.options.slpk) {
|
|
@@ -61811,6 +62043,105 @@ var NodeIndexDocument = class {
|
|
|
61811
62043
|
}
|
|
61812
62044
|
};
|
|
61813
62045
|
|
|
62046
|
+
// src/i3s-converter/helpers/load-3d-tiles.ts
|
|
62047
|
+
var loadNestedTileset = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
|
|
62048
|
+
const isTileset = sourceTile.type === "json";
|
|
62049
|
+
if (!sourceTileset || !sourceTile.contentUrl || !isTileset) {
|
|
62050
|
+
return;
|
|
62051
|
+
}
|
|
62052
|
+
const loadOptions = {
|
|
62053
|
+
...tilesetLoadOptions,
|
|
62054
|
+
[sourceTileset.loader.id]: {
|
|
62055
|
+
isTileset,
|
|
62056
|
+
assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
|
|
62057
|
+
}
|
|
62058
|
+
};
|
|
62059
|
+
const tileContent = await load(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
|
|
62060
|
+
if (tileContent.root) {
|
|
62061
|
+
sourceTile.children = [tileContent.root];
|
|
62062
|
+
}
|
|
62063
|
+
};
|
|
62064
|
+
var loadTile3DContent = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
|
|
62065
|
+
const isTileset = sourceTile.type === "json";
|
|
62066
|
+
if (!sourceTileset || !sourceTile.contentUrl || isTileset) {
|
|
62067
|
+
return null;
|
|
62068
|
+
}
|
|
62069
|
+
const loadOptions = {
|
|
62070
|
+
...tilesetLoadOptions,
|
|
62071
|
+
[sourceTileset.loader.id]: {
|
|
62072
|
+
...tilesetLoadOptions[sourceTileset.loader.id] || {},
|
|
62073
|
+
isTileset,
|
|
62074
|
+
assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
|
|
62075
|
+
}
|
|
62076
|
+
};
|
|
62077
|
+
const tileContent = await load(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
|
|
62078
|
+
return tileContent;
|
|
62079
|
+
};
|
|
62080
|
+
|
|
62081
|
+
// src/i3s-converter/i3s-converter.ts
|
|
62082
|
+
var import_core31 = __toModule(require_es5());
|
|
62083
|
+
|
|
62084
|
+
// src/i3s-converter/helpers/tileset-traversal.ts
|
|
62085
|
+
var traverseDatasetWith = async (tile, traversalProps, processTile, postprocessTile, maxDepth, level = 0) => {
|
|
62086
|
+
if (maxDepth && level > maxDepth) {
|
|
62087
|
+
return;
|
|
62088
|
+
}
|
|
62089
|
+
const processResults = [];
|
|
62090
|
+
const newTraversalProps = await processTile(tile, traversalProps);
|
|
62091
|
+
processResults.push(newTraversalProps);
|
|
62092
|
+
for (const childTile of tile.children) {
|
|
62093
|
+
await traverseDatasetWith(childTile, newTraversalProps, processTile, postprocessTile, maxDepth, level + 1);
|
|
62094
|
+
}
|
|
62095
|
+
postprocessTile && await postprocessTile(processResults, traversalProps);
|
|
62096
|
+
};
|
|
62097
|
+
|
|
62098
|
+
// src/i3s-converter/helpers/preprocess-3d-tiles.ts
|
|
62099
|
+
var GLTF_PRIMITIVE_MODES = [
|
|
62100
|
+
GltfPrimitiveModeString.POINTS,
|
|
62101
|
+
GltfPrimitiveModeString.LINES,
|
|
62102
|
+
GltfPrimitiveModeString.LINE_LOOP,
|
|
62103
|
+
GltfPrimitiveModeString.LINE_STRIP,
|
|
62104
|
+
GltfPrimitiveModeString.TRIANGLES,
|
|
62105
|
+
GltfPrimitiveModeString.TRIANGLE_STRIP,
|
|
62106
|
+
GltfPrimitiveModeString.TRIANGLE_FAN
|
|
62107
|
+
];
|
|
62108
|
+
var analyzeTileContent = async (tile, tileContent) => {
|
|
62109
|
+
const result = {
|
|
62110
|
+
meshTopologyTypes: new Set()
|
|
62111
|
+
};
|
|
62112
|
+
if (!tileContent?.gltfArrayBuffer) {
|
|
62113
|
+
return result;
|
|
62114
|
+
}
|
|
62115
|
+
const gltfData = await parse(tileContent.gltfArrayBuffer, GLTFLoader, {
|
|
62116
|
+
gltf: { normalize: false, loadBuffers: false, loadImages: false, decompressMeshes: false }
|
|
62117
|
+
});
|
|
62118
|
+
const gltf = gltfData.json;
|
|
62119
|
+
if (!gltf) {
|
|
62120
|
+
return result;
|
|
62121
|
+
}
|
|
62122
|
+
const meshTypes = getMeshTypesFromGltf(gltf);
|
|
62123
|
+
result.meshTopologyTypes = meshTypes;
|
|
62124
|
+
return result;
|
|
62125
|
+
};
|
|
62126
|
+
var getMeshTypesFromGltf = (gltfJson) => {
|
|
62127
|
+
const result = new Set();
|
|
62128
|
+
for (const mesh of gltfJson.meshes || []) {
|
|
62129
|
+
for (const primitive of mesh.primitives) {
|
|
62130
|
+
let { mode } = primitive;
|
|
62131
|
+
if (typeof mode !== "number") {
|
|
62132
|
+
mode = 4;
|
|
62133
|
+
}
|
|
62134
|
+
result.add(GLTF_PRIMITIVE_MODES[mode]);
|
|
62135
|
+
}
|
|
62136
|
+
}
|
|
62137
|
+
return result;
|
|
62138
|
+
};
|
|
62139
|
+
var mergePreprocessData = (object1, object2) => {
|
|
62140
|
+
for (const type of object2.meshTopologyTypes) {
|
|
62141
|
+
object1.meshTopologyTypes.add(type);
|
|
62142
|
+
}
|
|
62143
|
+
};
|
|
62144
|
+
|
|
61814
62145
|
// src/i3s-converter/i3s-converter.ts
|
|
61815
62146
|
var ION_DEFAULT_TOKEN = import_process2.default.env?.IonToken || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";
|
|
61816
62147
|
var HARDCODED_NODES_PER_PAGE = 64;
|
|
@@ -61824,11 +62155,24 @@ var I3SConverter = class {
|
|
|
61824
62155
|
this.conversionStartTime = [0, 0];
|
|
61825
62156
|
this.refreshTokenTime = [0, 0];
|
|
61826
62157
|
this.sourceTileset = null;
|
|
62158
|
+
this.loadOptions = {
|
|
62159
|
+
_nodeWorkers: true,
|
|
62160
|
+
reuseWorkers: true,
|
|
62161
|
+
basis: {
|
|
62162
|
+
format: "rgba32",
|
|
62163
|
+
workerUrl: "./modules/textures/dist/basis-worker-node.js"
|
|
62164
|
+
},
|
|
62165
|
+
draco: { workerUrl: "./modules/draco/dist/draco-worker-node.js" },
|
|
62166
|
+
fetch: {}
|
|
62167
|
+
};
|
|
61827
62168
|
this.geoidHeightModel = null;
|
|
61828
62169
|
this.Loader = Tiles3DLoader;
|
|
61829
62170
|
this.workerSource = {};
|
|
61830
62171
|
this.writeQueue = new WriteQueue();
|
|
61831
62172
|
this.compressList = null;
|
|
62173
|
+
this.preprocessData = {
|
|
62174
|
+
meshTopologyTypes: new Set()
|
|
62175
|
+
};
|
|
61832
62176
|
this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE, this);
|
|
61833
62177
|
this.options = {};
|
|
61834
62178
|
this.layers0Path = "";
|
|
@@ -61898,41 +62242,69 @@ var I3SConverter = class {
|
|
|
61898
62242
|
await this.loadWorkers();
|
|
61899
62243
|
try {
|
|
61900
62244
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
61901
|
-
const tilesetOptions = {
|
|
61902
|
-
loadOptions: {
|
|
61903
|
-
_nodeWorkers: true,
|
|
61904
|
-
reuseWorkers: true,
|
|
61905
|
-
basis: { format: "rgba32" }
|
|
61906
|
-
}
|
|
61907
|
-
};
|
|
61908
62245
|
if (preloadOptions.headers) {
|
|
61909
|
-
|
|
61910
|
-
}
|
|
61911
|
-
|
|
61912
|
-
const
|
|
61913
|
-
|
|
61914
|
-
|
|
61915
|
-
|
|
61916
|
-
|
|
62246
|
+
this.loadOptions.fetch = { headers: preloadOptions.headers };
|
|
62247
|
+
}
|
|
62248
|
+
this.sourceTileset = await load(inputUrl, this.Loader, this.loadOptions);
|
|
62249
|
+
const preprocessResult = await this.preprocessConversion();
|
|
62250
|
+
if (preprocessResult) {
|
|
62251
|
+
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
62252
|
+
await this._finishConversion({ slpk: Boolean(slpk), outputPath, tilesetName });
|
|
62253
|
+
}
|
|
61917
62254
|
} catch (error) {
|
|
61918
62255
|
throw error;
|
|
61919
62256
|
} finally {
|
|
62257
|
+
await this.writeQueue.finalize();
|
|
61920
62258
|
const workerFarm = WorkerFarm.getWorkerFarm({});
|
|
61921
62259
|
workerFarm.destroy();
|
|
61922
62260
|
}
|
|
62261
|
+
return "success";
|
|
61923
62262
|
}
|
|
61924
|
-
async
|
|
62263
|
+
async preprocessConversion() {
|
|
62264
|
+
console.log(`Analyze source tileset`);
|
|
62265
|
+
const sourceRootTile = this.sourceTileset.root;
|
|
62266
|
+
await traverseDatasetWith(sourceRootTile, null, this.analyzeTile.bind(this), void 0, this.options.maxDepth);
|
|
62267
|
+
const { meshTopologyTypes } = this.preprocessData;
|
|
62268
|
+
console.log(`------------------------------------------------`);
|
|
62269
|
+
console.log(`Preprocess results:`);
|
|
62270
|
+
console.log(`glTF mesh topology types: ${Array.from(meshTopologyTypes).join(", ")}`);
|
|
62271
|
+
console.log(`------------------------------------------------`);
|
|
62272
|
+
if (!meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLES) && !meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLE_STRIP)) {
|
|
62273
|
+
console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted.");
|
|
62274
|
+
console.log(`------------------------------------------------`);
|
|
62275
|
+
return false;
|
|
62276
|
+
}
|
|
62277
|
+
return true;
|
|
62278
|
+
}
|
|
62279
|
+
async analyzeTile(sourceTile, traversalProps) {
|
|
62280
|
+
if (sourceTile.type === "json") {
|
|
62281
|
+
await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);
|
|
62282
|
+
return null;
|
|
62283
|
+
}
|
|
62284
|
+
if (sourceTile.id) {
|
|
62285
|
+
console.log(`[analyze]: ${sourceTile.id}`);
|
|
62286
|
+
}
|
|
62287
|
+
const tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, {
|
|
62288
|
+
...this.loadOptions,
|
|
62289
|
+
"3d-tiles": { ...this.loadOptions["3d-tiles"], loadGLTF: false }
|
|
62290
|
+
});
|
|
62291
|
+
const tilePreprocessData = await analyzeTileContent(sourceTile, tileContent);
|
|
62292
|
+
mergePreprocessData(this.preprocessData, tilePreprocessData);
|
|
62293
|
+
return null;
|
|
62294
|
+
}
|
|
62295
|
+
async _createAndSaveTileset(outputPath, tilesetName) {
|
|
61925
62296
|
const tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
|
|
61926
62297
|
try {
|
|
61927
62298
|
await removeDir(tilesetPath);
|
|
61928
62299
|
} catch (e) {
|
|
61929
62300
|
}
|
|
61930
62301
|
this.layers0Path = (0, import_path8.join)(tilesetPath, "SceneServer", "layers", "0");
|
|
61931
|
-
this._formLayers0(tilesetName, boundingVolumeRegion);
|
|
61932
62302
|
this.materialDefinitions = [];
|
|
61933
62303
|
this.materialMap = new Map();
|
|
61934
62304
|
const sourceRootTile = this.sourceTileset.root;
|
|
61935
|
-
const
|
|
62305
|
+
const sourceBoundingVolume = createBoundingVolume(sourceRootTile.boundingVolume, new import_core31.Matrix4(sourceRootTile.transform), null);
|
|
62306
|
+
this._formLayers0(tilesetName, sourceBoundingVolume, this.sourceTileset?.root?.boundingVolume?.region);
|
|
62307
|
+
const boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
|
|
61936
62308
|
await this.nodePages.push({
|
|
61937
62309
|
index: 0,
|
|
61938
62310
|
lodThreshold: 0,
|
|
@@ -61940,7 +62312,10 @@ var I3SConverter = class {
|
|
|
61940
62312
|
children: []
|
|
61941
62313
|
});
|
|
61942
62314
|
const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);
|
|
61943
|
-
await
|
|
62315
|
+
await traverseDatasetWith(sourceRootTile, {
|
|
62316
|
+
transform: new import_core31.Matrix4(sourceRootTile.transform),
|
|
62317
|
+
parentNodes: [rootNode]
|
|
62318
|
+
}, this.convertTile.bind(this), this.finalizeTile.bind(this), this.options.maxDepth);
|
|
61944
62319
|
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
61945
62320
|
this.layers0.geometryDefinitions = (0, import_json_map_transform8.default)(this.geometryConfigs.map((config) => ({
|
|
61946
62321
|
geometryConfig: { ...config, draco: this.options.draco }
|
|
@@ -61958,8 +62333,11 @@ var I3SConverter = class {
|
|
|
61958
62333
|
await this.writeQueue.finalize();
|
|
61959
62334
|
await this._createSlpk(tilesetPath);
|
|
61960
62335
|
}
|
|
61961
|
-
_formLayers0(tilesetName, boundingVolumeRegion) {
|
|
61962
|
-
|
|
62336
|
+
_formLayers0(tilesetName, sourceBoundingVolume, boundingVolumeRegion) {
|
|
62337
|
+
if (!this.sourceTileset?.root) {
|
|
62338
|
+
return;
|
|
62339
|
+
}
|
|
62340
|
+
const fullExtent = convertBoundingVolumeToI3SFullExtent(sourceBoundingVolume);
|
|
61963
62341
|
if (boundingVolumeRegion) {
|
|
61964
62342
|
fullExtent.zmin = boundingVolumeRegion[4];
|
|
61965
62343
|
fullExtent.zmax = boundingVolumeRegion[5];
|
|
@@ -61982,24 +62360,6 @@ var I3SConverter = class {
|
|
|
61982
62360
|
};
|
|
61983
62361
|
this.layers0 = (0, import_json_map_transform8.default)(layers0data, LAYERS());
|
|
61984
62362
|
}
|
|
61985
|
-
async _convertNodesTree(rootNode, sourceRootTile) {
|
|
61986
|
-
await this.sourceTileset._loadTile(sourceRootTile);
|
|
61987
|
-
if (this.isContentSupported(sourceRootTile)) {
|
|
61988
|
-
const childNodes = await this._createNode(rootNode, sourceRootTile, 0);
|
|
61989
|
-
for (const childNode of childNodes) {
|
|
61990
|
-
await childNode.save();
|
|
61991
|
-
}
|
|
61992
|
-
await rootNode.addChildren(childNodes);
|
|
61993
|
-
} else {
|
|
61994
|
-
await this._addChildrenWithNeighborsAndWriteFile({
|
|
61995
|
-
parentNode: rootNode,
|
|
61996
|
-
sourceTiles: sourceRootTile.children,
|
|
61997
|
-
level: 1
|
|
61998
|
-
});
|
|
61999
|
-
}
|
|
62000
|
-
await sourceRootTile.unloadContent();
|
|
62001
|
-
await rootNode.save();
|
|
62002
|
-
}
|
|
62003
62363
|
async _writeLayers0() {
|
|
62004
62364
|
if (this.options.slpk) {
|
|
62005
62365
|
await this.writeQueue.enqueue({
|
|
@@ -62023,57 +62383,54 @@ var I3SConverter = class {
|
|
|
62023
62383
|
}
|
|
62024
62384
|
}
|
|
62025
62385
|
}
|
|
62026
|
-
async
|
|
62027
|
-
|
|
62028
|
-
await data.parentNode.addNeighbors();
|
|
62029
|
-
}
|
|
62030
|
-
async convertNestedTileset({
|
|
62031
|
-
parentNode,
|
|
62032
|
-
sourceTile,
|
|
62033
|
-
level
|
|
62034
|
-
}) {
|
|
62035
|
-
await this.sourceTileset._loadTile(sourceTile);
|
|
62036
|
-
await this._addChildren({
|
|
62037
|
-
parentNode,
|
|
62038
|
-
sourceTiles: sourceTile.children,
|
|
62039
|
-
level: level + 1
|
|
62040
|
-
});
|
|
62041
|
-
await sourceTile.unloadContent();
|
|
62042
|
-
}
|
|
62043
|
-
async convertNode({
|
|
62044
|
-
parentNode,
|
|
62045
|
-
sourceTile,
|
|
62046
|
-
level
|
|
62047
|
-
}) {
|
|
62048
|
-
const childNodes = await this._createNode(parentNode, sourceTile, level);
|
|
62049
|
-
await parentNode.addChildren(childNodes);
|
|
62050
|
-
}
|
|
62051
|
-
async _addChildren(data) {
|
|
62052
|
-
const { sourceTiles, parentNode, level } = data;
|
|
62053
|
-
if (this.options.maxDepth && level > this.options.maxDepth) {
|
|
62054
|
-
return;
|
|
62055
|
-
}
|
|
62056
|
-
for (const sourceTile of sourceTiles) {
|
|
62386
|
+
async convertTile(sourceTile, traversalProps) {
|
|
62387
|
+
if (sourceTile.type === "json" || sourceTile.type === "empty") {
|
|
62057
62388
|
if (sourceTile.type === "json") {
|
|
62058
|
-
|
|
62059
|
-
|
|
62060
|
-
|
|
62389
|
+
if (sourceTile.id) {
|
|
62390
|
+
console.log(`[load]: ${sourceTile.id}`);
|
|
62391
|
+
}
|
|
62392
|
+
await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);
|
|
62061
62393
|
}
|
|
62062
|
-
|
|
62063
|
-
|
|
62394
|
+
return traversalProps;
|
|
62395
|
+
}
|
|
62396
|
+
if (sourceTile.id) {
|
|
62397
|
+
console.log(`[convert]: ${sourceTile.id}`);
|
|
62398
|
+
}
|
|
62399
|
+
const { parentNodes, transform: transform11 } = traversalProps;
|
|
62400
|
+
let transformationMatrix = transform11.clone();
|
|
62401
|
+
if (sourceTile.transform) {
|
|
62402
|
+
transformationMatrix = transformationMatrix.multiplyRight(sourceTile.transform);
|
|
62403
|
+
}
|
|
62404
|
+
const parentNode = parentNodes[0];
|
|
62405
|
+
const childNodes = await this._createNode(parentNode, sourceTile, transformationMatrix);
|
|
62406
|
+
await parentNode.addChildren(childNodes);
|
|
62407
|
+
const newTraversalProps = {
|
|
62408
|
+
transform: transformationMatrix,
|
|
62409
|
+
parentNodes: childNodes
|
|
62410
|
+
};
|
|
62411
|
+
return newTraversalProps;
|
|
62412
|
+
}
|
|
62413
|
+
async finalizeTile(conversionResults, currentTraversalProps) {
|
|
62414
|
+
for (const result of conversionResults) {
|
|
62415
|
+
for (const node2 of result.parentNodes) {
|
|
62416
|
+
await node2.addNeighbors();
|
|
62064
62417
|
}
|
|
62065
62418
|
}
|
|
62419
|
+
for (const node2 of currentTraversalProps.parentNodes) {
|
|
62420
|
+
await node2.save();
|
|
62421
|
+
}
|
|
62066
62422
|
}
|
|
62067
|
-
async _createNode(parentNode, sourceTile,
|
|
62423
|
+
async _createNode(parentNode, sourceTile, transformationMatrix) {
|
|
62068
62424
|
this._checkAddRefinementTypeForTile(sourceTile);
|
|
62069
62425
|
await this._updateTilesetOptions();
|
|
62070
|
-
await this.sourceTileset.
|
|
62071
|
-
|
|
62072
|
-
|
|
62426
|
+
const tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);
|
|
62427
|
+
const sourceBoundingVolume = createBoundingVolume(sourceTile.boundingVolume, transformationMatrix, null);
|
|
62428
|
+
let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
|
|
62429
|
+
const propertyTable = getPropertyTable(tileContent);
|
|
62073
62430
|
if (propertyTable && !this.layers0?.attributeStorageInfo?.length) {
|
|
62074
62431
|
this._convertPropertyTableToNodeAttributes(propertyTable);
|
|
62075
62432
|
}
|
|
62076
|
-
const resourcesData = await this._convertResources(sourceTile, parentNode.inPageId, propertyTable);
|
|
62433
|
+
const resourcesData = await this._convertResources(sourceTile, transformationMatrix, sourceBoundingVolume, tileContent, parentNode.inPageId, propertyTable);
|
|
62077
62434
|
const nodes = [];
|
|
62078
62435
|
const nodeIds = [];
|
|
62079
62436
|
const nodesInPage = [];
|
|
@@ -62112,16 +62469,10 @@ var I3SConverter = class {
|
|
|
62112
62469
|
nodeIds.push(nodeInPage.index);
|
|
62113
62470
|
nodesInPage.push(nodeInPage);
|
|
62114
62471
|
}
|
|
62115
|
-
sourceTile.unloadContent();
|
|
62116
|
-
await this._addChildrenWithNeighborsAndWriteFile({
|
|
62117
|
-
parentNode: nodes[0],
|
|
62118
|
-
sourceTiles: sourceTile.children,
|
|
62119
|
-
level: level + 1
|
|
62120
|
-
});
|
|
62121
62472
|
return nodes;
|
|
62122
62473
|
}
|
|
62123
|
-
async _convertResources(sourceTile, parentId, propertyTable) {
|
|
62124
|
-
if (!this.isContentSupported(sourceTile)) {
|
|
62474
|
+
async _convertResources(sourceTile, transformationMatrix, boundingVolume, tileContent, parentId, propertyTable) {
|
|
62475
|
+
if (!this.isContentSupported(sourceTile) || !tileContent) {
|
|
62125
62476
|
return null;
|
|
62126
62477
|
}
|
|
62127
62478
|
const draftObb = {
|
|
@@ -62129,7 +62480,7 @@ var I3SConverter = class {
|
|
|
62129
62480
|
halfSize: [],
|
|
62130
62481
|
quaternion: []
|
|
62131
62482
|
};
|
|
62132
|
-
const resourcesData = await convertB3dmToI3sGeometry(
|
|
62483
|
+
const resourcesData = await convertB3dmToI3sGeometry(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.workerSource);
|
|
62133
62484
|
return resourcesData;
|
|
62134
62485
|
}
|
|
62135
62486
|
async _updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
|
|
@@ -62399,10 +62750,9 @@ var I3SConverter = class {
|
|
|
62399
62750
|
}
|
|
62400
62751
|
this.refreshTokenTime = import_process2.default.hrtime();
|
|
62401
62752
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
62402
|
-
this.sourceTileset.options = { ...this.sourceTileset.options, ...preloadOptions };
|
|
62403
62753
|
if (preloadOptions.headers) {
|
|
62404
|
-
this.
|
|
62405
|
-
...this.
|
|
62754
|
+
this.loadOptions.fetch = {
|
|
62755
|
+
...this.loadOptions.fetch,
|
|
62406
62756
|
headers: preloadOptions.headers
|
|
62407
62757
|
};
|
|
62408
62758
|
console.log("Authorization Bearer token has been updated");
|
|
@@ -62416,8 +62766,8 @@ var I3SConverter = class {
|
|
|
62416
62766
|
}
|
|
62417
62767
|
this.refinementCounter.tilesCount += 1;
|
|
62418
62768
|
}
|
|
62419
|
-
isContentSupported(
|
|
62420
|
-
return ["b3dm", "glTF"].includes(
|
|
62769
|
+
isContentSupported(sourceTile) {
|
|
62770
|
+
return ["b3dm", "glTF", "scenegraph"].includes(sourceTile.type || "");
|
|
62421
62771
|
}
|
|
62422
62772
|
async loadWorkers() {
|
|
62423
62773
|
console.log(`Loading workers source...`);
|
|
@@ -62525,8 +62875,8 @@ var COORDINATE_SYSTEM;
|
|
|
62525
62875
|
})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
|
|
62526
62876
|
|
|
62527
62877
|
// ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
|
|
62528
|
-
var
|
|
62529
|
-
var
|
|
62878
|
+
var import_core34 = __toModule(require_es5());
|
|
62879
|
+
var import_geospatial13 = __toModule(require_es52());
|
|
62530
62880
|
|
|
62531
62881
|
// ../i3s/src/lib/utils/url-utils.ts
|
|
62532
62882
|
function getUrlWithToken(url, token = null) {
|
|
@@ -62630,7 +62980,7 @@ function getAttributeValueType(attribute) {
|
|
|
62630
62980
|
return "";
|
|
62631
62981
|
}
|
|
62632
62982
|
|
|
62633
|
-
// ../i3s/src/lib/utils/
|
|
62983
|
+
// ../i3s/src/lib/utils/customize-сolors.ts
|
|
62634
62984
|
async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
|
|
62635
62985
|
if (!options?.i3s?.colorsByAttribute) {
|
|
62636
62986
|
return colors;
|
|
@@ -62660,7 +63010,13 @@ async function customizeColors(colors, featureIds, tileOptions, tilesetOptions,
|
|
|
62660
63010
|
if (!color) {
|
|
62661
63011
|
continue;
|
|
62662
63012
|
}
|
|
62663
|
-
|
|
63013
|
+
if (options.i3s.colorsByAttribute.mode === "multiply") {
|
|
63014
|
+
color.forEach((colorItem, index) => {
|
|
63015
|
+
colors.value[i * 4 + index] = colors.value[i * 4 + index] * colorItem / 255;
|
|
63016
|
+
});
|
|
63017
|
+
} else {
|
|
63018
|
+
colors.value.set(color, i * 4);
|
|
63019
|
+
}
|
|
62664
63020
|
}
|
|
62665
63021
|
return colors;
|
|
62666
63022
|
}
|
|
@@ -62691,7 +63047,7 @@ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attr
|
|
|
62691
63047
|
}
|
|
62692
63048
|
|
|
62693
63049
|
// ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
|
|
62694
|
-
var scratchVector6 = new
|
|
63050
|
+
var scratchVector6 = new import_core34.Vector3([0, 0, 0]);
|
|
62695
63051
|
function getLoaderForTextureFormat(textureFormat) {
|
|
62696
63052
|
switch (textureFormat) {
|
|
62697
63053
|
case "ktx-etc2":
|
|
@@ -62712,7 +63068,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
|
|
|
62712
63068
|
indices: null,
|
|
62713
63069
|
featureIds: [],
|
|
62714
63070
|
vertexCount: 0,
|
|
62715
|
-
modelMatrix: new
|
|
63071
|
+
modelMatrix: new import_core34.Matrix4(),
|
|
62716
63072
|
coordinateSystem: 0,
|
|
62717
63073
|
byteLength: 0,
|
|
62718
63074
|
texture: null
|
|
@@ -62937,11 +63293,11 @@ function parsePositions2(attribute, options) {
|
|
|
62937
63293
|
const mbs = options.mbs;
|
|
62938
63294
|
const value = attribute.value;
|
|
62939
63295
|
const metadata = attribute.metadata;
|
|
62940
|
-
const enuMatrix = new
|
|
62941
|
-
const cartographicOrigin = new
|
|
62942
|
-
const cartesianOrigin = new
|
|
62943
|
-
|
|
62944
|
-
|
|
63296
|
+
const enuMatrix = new import_core34.Matrix4();
|
|
63297
|
+
const cartographicOrigin = new import_core34.Vector3(mbs[0], mbs[1], mbs[2]);
|
|
63298
|
+
const cartesianOrigin = new import_core34.Vector3();
|
|
63299
|
+
import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
|
|
63300
|
+
import_geospatial13.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
|
|
62945
63301
|
attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
|
|
62946
63302
|
return enuMatrix;
|
|
62947
63303
|
}
|
|
@@ -62955,7 +63311,7 @@ function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
|
|
|
62955
63311
|
positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;
|
|
62956
63312
|
}
|
|
62957
63313
|
for (let i = 0; i < positions.length; i += 3) {
|
|
62958
|
-
|
|
63314
|
+
import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector6);
|
|
62959
63315
|
positions[i] = scratchVector6.x;
|
|
62960
63316
|
positions[i + 1] = scratchVector6.y;
|
|
62961
63317
|
positions[i + 2] = scratchVector6.z;
|
|
@@ -62966,7 +63322,7 @@ function getModelMatrix(positions) {
|
|
|
62966
63322
|
const metadata = positions.metadata;
|
|
62967
63323
|
const scaleX = metadata?.["i3s-scale_x"]?.double || 1;
|
|
62968
63324
|
const scaleY = metadata?.["i3s-scale_y"]?.double || 1;
|
|
62969
|
-
const modelMatrix = new
|
|
63325
|
+
const modelMatrix = new import_core34.Matrix4();
|
|
62970
63326
|
modelMatrix[0] = scaleX;
|
|
62971
63327
|
modelMatrix[5] = scaleY;
|
|
62972
63328
|
return modelMatrix;
|
|
@@ -63092,7 +63448,7 @@ async function parse6(data, options, context) {
|
|
|
63092
63448
|
|
|
63093
63449
|
// ../i3s/src/lib/parsers/parse-i3s.ts
|
|
63094
63450
|
var import_culling8 = __toModule(require_es53());
|
|
63095
|
-
var
|
|
63451
|
+
var import_geospatial14 = __toModule(require_es52());
|
|
63096
63452
|
|
|
63097
63453
|
// ../i3s/src/i3s-node-page-loader.ts
|
|
63098
63454
|
var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -63310,12 +63666,12 @@ function normalizeTileNonUrlData(tile) {
|
|
|
63310
63666
|
if (tile.mbs) {
|
|
63311
63667
|
mbs = tile.mbs;
|
|
63312
63668
|
boundingVolume.sphere = [
|
|
63313
|
-
...
|
|
63669
|
+
...import_geospatial14.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
|
|
63314
63670
|
tile.mbs[3]
|
|
63315
63671
|
];
|
|
63316
63672
|
} else if (tile.obb) {
|
|
63317
63673
|
boundingVolume.box = [
|
|
63318
|
-
...
|
|
63674
|
+
...import_geospatial14.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
|
|
63319
63675
|
...tile.obb.halfSize,
|
|
63320
63676
|
...tile.obb.quaternion
|
|
63321
63677
|
];
|
|
@@ -63437,8 +63793,8 @@ function getMagicNumber(data) {
|
|
|
63437
63793
|
}
|
|
63438
63794
|
|
|
63439
63795
|
// src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
|
|
63440
|
-
var
|
|
63441
|
-
var
|
|
63796
|
+
var import_core38 = __toModule(require_es5());
|
|
63797
|
+
var import_geospatial15 = __toModule(require_es52());
|
|
63442
63798
|
var import_culling9 = __toModule(require_es53());
|
|
63443
63799
|
function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
63444
63800
|
const tiles3DCenter = [
|
|
@@ -63446,7 +63802,7 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
|
63446
63802
|
i3SObb.center[1],
|
|
63447
63803
|
i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
|
|
63448
63804
|
];
|
|
63449
|
-
const cartesianCenter =
|
|
63805
|
+
const cartesianCenter = import_geospatial15.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core38.Vector3());
|
|
63450
63806
|
const tiles3DObb = new import_culling9.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
|
|
63451
63807
|
return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
|
|
63452
63808
|
}
|