@loaders.gl/tile-converter 4.0.0-alpha.13 → 4.0.0-alpha.14
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-converter/3d-tiles-converter.d.ts +0 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +8 -19
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +4 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/converter.min.js +65 -65
- package/dist/dist.min.js +641 -135
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +34 -67
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +10 -21
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +8 -18
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +0 -7
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +2 -2
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +0 -5
- package/dist/i3s-converter/types.d.ts +32 -1
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/package.json +16 -18
- package/src/3d-tiles-converter/3d-tiles-converter.ts +10 -28
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +5 -2
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +1 -1
- package/src/i3s-converter/helpers/geometry-converter.ts +2 -7
- package/src/i3s-converter/helpers/gltf-attributes.ts +2 -2
- package/src/i3s-converter/i3s-converter.ts +0 -5
- package/src/i3s-converter/types.ts +32 -1
- package/dist/3d-tiles-attributes-worker.d.ts +0 -28
- package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/3d-tiles-attributes-worker.js +0 -3
- package/dist/3d-tiles-attributes-worker.js.map +0 -7
- package/dist/es5/3d-tiles-attributes-worker.js +0 -25
- package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-attributes-worker.js +0 -25
- package/dist/es5/i3s-attributes-worker.js.map +0 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/workers/i3s-attributes-worker.js +0 -30
- package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/3d-tiles-attributes-worker.js +0 -16
- package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-attributes-worker.js +0 -16
- package/dist/esm/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/workers/i3s-attributes-worker.js +0 -7
- package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/i3s-attributes-worker.d.ts +0 -45
- package/dist/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/i3s-attributes-worker.js +0 -9
- package/dist/i3s-attributes-worker.js.map +0 -7
- package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/workers/3d-tiles-attributes-worker.js +0 -9
- package/dist/workers/i3s-attributes-worker.d.ts +0 -2
- package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/workers/i3s-attributes-worker.js +0 -5
- package/src/3d-tiles-attributes-worker.ts +0 -43
- package/src/i3s-attributes-worker.ts +0 -59
- package/src/workers/3d-tiles-attributes-worker.ts +0 -6
- package/src/workers/i3s-attributes-worker.ts +0 -7
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 Vector324 = function(_Vector) {
|
|
2177
|
+
(0, _inherits2.default)(Vector325, _Vector);
|
|
2178
|
+
var _super = _createSuper(Vector325);
|
|
2179
|
+
function Vector325() {
|
|
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, Vector325);
|
|
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)(Vector325, [{
|
|
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 Vector325(0, 0, 0);
|
|
2322
2322
|
Object.freeze(ZERO2);
|
|
2323
2323
|
}
|
|
2324
2324
|
return ZERO2;
|
|
2325
2325
|
}
|
|
2326
2326
|
}]);
|
|
2327
|
-
return
|
|
2327
|
+
return Vector325;
|
|
2328
2328
|
}(_vector.default);
|
|
2329
|
-
exports.default =
|
|
2329
|
+
exports.default = Vector324;
|
|
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 Matrix413 = function(_Matrix) {
|
|
5294
|
+
(0, _inherits2.default)(Matrix414, _Matrix);
|
|
5295
|
+
var _super = _createSuper(Matrix414);
|
|
5296
|
+
function Matrix414(array) {
|
|
5297
5297
|
var _this;
|
|
5298
|
-
(0, _classCallCheck2.default)(this,
|
|
5298
|
+
(0, _classCallCheck2.default)(this, Matrix414);
|
|
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)(Matrix414, [{
|
|
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 Matrix414;
|
|
5689
5689
|
}(_matrix.default);
|
|
5690
|
-
exports.default =
|
|
5690
|
+
exports.default = Matrix413;
|
|
5691
5691
|
var ZERO2;
|
|
5692
5692
|
var IDENTITY;
|
|
5693
5693
|
function getZeroMatrix() {
|
|
5694
5694
|
if (!ZERO2) {
|
|
5695
|
-
ZERO2 = new
|
|
5695
|
+
ZERO2 = new Matrix413([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 Matrix413();
|
|
5703
5703
|
Object.freeze(IDENTITY);
|
|
5704
5704
|
}
|
|
5705
5705
|
return IDENTITY;
|
|
@@ -7848,7 +7848,7 @@ var require_type_utils = __commonJS({
|
|
|
7848
7848
|
function identity(x) {
|
|
7849
7849
|
return x;
|
|
7850
7850
|
}
|
|
7851
|
-
var
|
|
7851
|
+
var scratchVector8 = new _core.Vector3();
|
|
7852
7852
|
function fromCartographic(cartographic) {
|
|
7853
7853
|
var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
7854
7854
|
var map = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : identity;
|
|
@@ -7902,7 +7902,7 @@ var require_type_utils = __commonJS({
|
|
|
7902
7902
|
if (!vector) {
|
|
7903
7903
|
return false;
|
|
7904
7904
|
}
|
|
7905
|
-
|
|
7905
|
+
scratchVector8.from(vector);
|
|
7906
7906
|
var oneOverRadiiSquared = _constants.WGS84_CONSTANTS.oneOverRadiiSquared, centerToleranceSquared = _constants.WGS84_CONSTANTS.centerToleranceSquared;
|
|
7907
7907
|
var x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];
|
|
7908
7908
|
var y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];
|
|
@@ -7921,16 +7921,16 @@ var require_scale_to_geodetic_surface = __commonJS({
|
|
|
7921
7921
|
});
|
|
7922
7922
|
exports.default = scaleToGeodeticSurface;
|
|
7923
7923
|
var _core = require_es5();
|
|
7924
|
-
var
|
|
7924
|
+
var scratchVector8 = new _core.Vector3();
|
|
7925
7925
|
var scaleToGeodeticSurfaceIntersection = new _core.Vector3();
|
|
7926
7926
|
var scaleToGeodeticSurfaceGradient = new _core.Vector3();
|
|
7927
7927
|
function scaleToGeodeticSurface(cartesian, ellipsoid) {
|
|
7928
7928
|
var result = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
7929
7929
|
var oneOverRadii = ellipsoid.oneOverRadii, oneOverRadiiSquared = ellipsoid.oneOverRadiiSquared, centerToleranceSquared = ellipsoid.centerToleranceSquared;
|
|
7930
|
-
|
|
7931
|
-
var positionX =
|
|
7932
|
-
var positionY =
|
|
7933
|
-
var positionZ =
|
|
7930
|
+
scratchVector8.from(cartesian);
|
|
7931
|
+
var positionX = scratchVector8.x;
|
|
7932
|
+
var positionY = scratchVector8.y;
|
|
7933
|
+
var positionZ = scratchVector8.z;
|
|
7934
7934
|
var oneOverRadiiX = oneOverRadii.x;
|
|
7935
7935
|
var oneOverRadiiY = oneOverRadii.y;
|
|
7936
7936
|
var oneOverRadiiZ = oneOverRadii.z;
|
|
@@ -7952,7 +7952,7 @@ var require_scale_to_geodetic_surface = __commonJS({
|
|
|
7952
7952
|
var oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
|
|
7953
7953
|
var gradient = scaleToGeodeticSurfaceGradient;
|
|
7954
7954
|
gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
|
|
7955
|
-
var lambda = (1 - ratio) *
|
|
7955
|
+
var lambda = (1 - ratio) * scratchVector8.len() / (0.5 * gradient.len());
|
|
7956
7956
|
var correction = 0;
|
|
7957
7957
|
var xMultiplier;
|
|
7958
7958
|
var yMultiplier;
|
|
@@ -7974,7 +7974,7 @@ var require_scale_to_geodetic_surface = __commonJS({
|
|
|
7974
7974
|
var derivative = -2 * denominator;
|
|
7975
7975
|
correction = func / derivative;
|
|
7976
7976
|
} while (Math.abs(func) > _core._MathUtils.EPSILON12);
|
|
7977
|
-
return
|
|
7977
|
+
return scratchVector8.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
|
|
7978
7978
|
}
|
|
7979
7979
|
}
|
|
7980
7980
|
});
|
|
@@ -8161,18 +8161,18 @@ var require_ellipsoid = __commonJS({
|
|
|
8161
8161
|
}
|
|
8162
8162
|
return newObj;
|
|
8163
8163
|
}
|
|
8164
|
-
var
|
|
8164
|
+
var scratchVector8 = new _core.Vector3();
|
|
8165
8165
|
var scratchNormal2 = new _core.Vector3();
|
|
8166
8166
|
var scratchK = new _core.Vector3();
|
|
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 Ellipsoid17 = function() {
|
|
8171
|
+
function Ellipsoid18() {
|
|
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, Ellipsoid18);
|
|
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)(Ellipsoid18, [{
|
|
8201
8201
|
key: "equals",
|
|
8202
8202
|
value: function equals2(right) {
|
|
8203
8203
|
return this === right || Boolean(right && this.radii.equals(right.radii));
|
|
@@ -8255,7 +8255,7 @@ var require_ellipsoid = __commonJS({
|
|
|
8255
8255
|
key: "geocentricSurfaceNormal",
|
|
8256
8256
|
value: function geocentricSurfaceNormal(cartesian) {
|
|
8257
8257
|
var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
|
|
8258
|
-
return
|
|
8258
|
+
return scratchVector8.from(cartesian).normalize().to(result);
|
|
8259
8259
|
}
|
|
8260
8260
|
}, {
|
|
8261
8261
|
key: "geodeticSurfaceNormalCartographic",
|
|
@@ -8265,14 +8265,14 @@ var require_ellipsoid = __commonJS({
|
|
|
8265
8265
|
var longitude = cartographicVectorRadians[0];
|
|
8266
8266
|
var latitude = cartographicVectorRadians[1];
|
|
8267
8267
|
var cosLatitude = Math.cos(latitude);
|
|
8268
|
-
|
|
8269
|
-
return
|
|
8268
|
+
scratchVector8.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
|
|
8269
|
+
return scratchVector8.to(result);
|
|
8270
8270
|
}
|
|
8271
8271
|
}, {
|
|
8272
8272
|
key: "geodeticSurfaceNormal",
|
|
8273
8273
|
value: function geodeticSurfaceNormal(cartesian) {
|
|
8274
8274
|
var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
|
|
8275
|
-
return
|
|
8275
|
+
return scratchVector8.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
|
|
8276
8276
|
}
|
|
8277
8277
|
}, {
|
|
8278
8278
|
key: "scaleToGeodeticSurface",
|
|
@@ -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 Ellipsoid18;
|
|
8322
8322
|
}();
|
|
8323
|
-
exports.default =
|
|
8324
|
-
(0, _defineProperty2.default)(
|
|
8323
|
+
exports.default = Ellipsoid17;
|
|
8324
|
+
(0, _defineProperty2.default)(Ellipsoid17, "WGS84", new Ellipsoid17(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
|
|
8325
8325
|
}
|
|
8326
8326
|
});
|
|
8327
8327
|
|
|
@@ -8381,7 +8381,7 @@ var require_axis_aligned_bounding_box = __commonJS({
|
|
|
8381
8381
|
var _defineProperty2 = _interopRequireDefault(require_defineProperty());
|
|
8382
8382
|
var _core = require_es5();
|
|
8383
8383
|
var _constants = require_constants2();
|
|
8384
|
-
var
|
|
8384
|
+
var scratchVector8 = new _core.Vector3();
|
|
8385
8385
|
var scratchNormal2 = new _core.Vector3();
|
|
8386
8386
|
var AxisAlignedBoundingBox = function() {
|
|
8387
8387
|
function AxisAlignedBoundingBox2() {
|
|
@@ -8393,7 +8393,7 @@ var require_axis_aligned_bounding_box = __commonJS({
|
|
|
8393
8393
|
(0, _defineProperty2.default)(this, "halfDiagonal", void 0);
|
|
8394
8394
|
(0, _defineProperty2.default)(this, "minimum", void 0);
|
|
8395
8395
|
(0, _defineProperty2.default)(this, "maximum", void 0);
|
|
8396
|
-
center = center ||
|
|
8396
|
+
center = center || scratchVector8.copy(minimum).add(maximum).scale(0.5);
|
|
8397
8397
|
this.center = new _core.Vector3(center);
|
|
8398
8398
|
this.halfDiagonal = new _core.Vector3(maximum).subtract(this.center);
|
|
8399
8399
|
this.minimum = new _core.Vector3(minimum);
|
|
@@ -8441,7 +8441,7 @@ var require_axis_aligned_bounding_box = __commonJS({
|
|
|
8441
8441
|
}, {
|
|
8442
8442
|
key: "distanceSquaredTo",
|
|
8443
8443
|
value: function distanceSquaredTo(point) {
|
|
8444
|
-
var offset =
|
|
8444
|
+
var offset = scratchVector8.from(point).subtract(this.center);
|
|
8445
8445
|
var halfDiagonal = this.halfDiagonal;
|
|
8446
8446
|
var distanceSquared = 0;
|
|
8447
8447
|
var d;
|
|
@@ -8520,7 +8520,7 @@ var require_bounding_sphere = __commonJS({
|
|
|
8520
8520
|
}
|
|
8521
8521
|
return newObj;
|
|
8522
8522
|
}
|
|
8523
|
-
var
|
|
8523
|
+
var scratchVector8 = new _core.Vector3();
|
|
8524
8524
|
var scratchVector23 = new _core.Vector3();
|
|
8525
8525
|
var BoundingSphere5 = function() {
|
|
8526
8526
|
function BoundingSphere6() {
|
|
@@ -8543,7 +8543,7 @@ var require_bounding_sphere = __commonJS({
|
|
|
8543
8543
|
}, {
|
|
8544
8544
|
key: "fromCornerPoints",
|
|
8545
8545
|
value: function fromCornerPoints(corner, oppositeCorner) {
|
|
8546
|
-
oppositeCorner =
|
|
8546
|
+
oppositeCorner = scratchVector8.from(oppositeCorner);
|
|
8547
8547
|
this.center = new _core.Vector3().from(corner).add(oppositeCorner).scale(0.5);
|
|
8548
8548
|
this.radius = this.center.distance(oppositeCorner);
|
|
8549
8549
|
return this;
|
|
@@ -8565,7 +8565,7 @@ var require_bounding_sphere = __commonJS({
|
|
|
8565
8565
|
var leftRadius = this.radius;
|
|
8566
8566
|
var rightCenter = boundingSphere.center;
|
|
8567
8567
|
var rightRadius = boundingSphere.radius;
|
|
8568
|
-
var toRightCenter =
|
|
8568
|
+
var toRightCenter = scratchVector8.copy(rightCenter).subtract(leftCenter);
|
|
8569
8569
|
var centerSeparation = toRightCenter.magnitude();
|
|
8570
8570
|
if (leftRadius >= centerSeparation + rightRadius) {
|
|
8571
8571
|
return this.clone();
|
|
@@ -8582,7 +8582,7 @@ var require_bounding_sphere = __commonJS({
|
|
|
8582
8582
|
}, {
|
|
8583
8583
|
key: "expand",
|
|
8584
8584
|
value: function expand(point) {
|
|
8585
|
-
var scratchPoint2 =
|
|
8585
|
+
var scratchPoint2 = scratchVector8.from(point);
|
|
8586
8586
|
var radius = scratchPoint2.subtract(this.center).magnitude();
|
|
8587
8587
|
if (radius > this.radius) {
|
|
8588
8588
|
this.radius = radius;
|
|
@@ -8593,7 +8593,7 @@ var require_bounding_sphere = __commonJS({
|
|
|
8593
8593
|
key: "transform",
|
|
8594
8594
|
value: function transform11(_transform) {
|
|
8595
8595
|
this.center.transform(_transform);
|
|
8596
|
-
var scale = mat4.getScaling(
|
|
8596
|
+
var scale = mat4.getScaling(scratchVector8, _transform);
|
|
8597
8597
|
this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
|
|
8598
8598
|
return this;
|
|
8599
8599
|
}
|
|
@@ -8606,7 +8606,7 @@ var require_bounding_sphere = __commonJS({
|
|
|
8606
8606
|
}, {
|
|
8607
8607
|
key: "distanceTo",
|
|
8608
8608
|
value: function distanceTo(point) {
|
|
8609
|
-
var scratchPoint2 =
|
|
8609
|
+
var scratchPoint2 = scratchVector8.from(point);
|
|
8610
8610
|
var delta = scratchPoint2.subtract(this.center);
|
|
8611
8611
|
return Math.max(0, delta.len() - this.radius);
|
|
8612
8612
|
}
|
|
@@ -47432,6 +47432,54 @@ function copyToArray(source, target, targetOffset) {
|
|
|
47432
47432
|
return targetOffset + padToNBytes(sourceArray.byteLength, 4);
|
|
47433
47433
|
}
|
|
47434
47434
|
|
|
47435
|
+
// ../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts
|
|
47436
|
+
function padStringToByteAlignment(string, byteAlignment) {
|
|
47437
|
+
const length = string.length;
|
|
47438
|
+
const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
|
|
47439
|
+
const padding = paddedLength - length;
|
|
47440
|
+
let whitespace = "";
|
|
47441
|
+
for (let i = 0; i < padding; ++i) {
|
|
47442
|
+
whitespace += " ";
|
|
47443
|
+
}
|
|
47444
|
+
return string + whitespace;
|
|
47445
|
+
}
|
|
47446
|
+
function copyStringToDataView(dataView, byteOffset, string, byteLength) {
|
|
47447
|
+
if (dataView) {
|
|
47448
|
+
for (let i = 0; i < byteLength; i++) {
|
|
47449
|
+
dataView.setUint8(byteOffset + i, string.charCodeAt(i));
|
|
47450
|
+
}
|
|
47451
|
+
}
|
|
47452
|
+
return byteOffset + byteLength;
|
|
47453
|
+
}
|
|
47454
|
+
function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
|
|
47455
|
+
if (dataView) {
|
|
47456
|
+
for (let i = 0; i < byteLength; i++) {
|
|
47457
|
+
dataView.setUint8(byteOffset + i, binary[i]);
|
|
47458
|
+
}
|
|
47459
|
+
}
|
|
47460
|
+
return byteOffset + byteLength;
|
|
47461
|
+
}
|
|
47462
|
+
function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
|
|
47463
|
+
const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
|
|
47464
|
+
const padLength = paddedLength - sourceBuffer.byteLength;
|
|
47465
|
+
if (dataView) {
|
|
47466
|
+
const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
|
|
47467
|
+
const sourceArray = new Uint8Array(sourceBuffer);
|
|
47468
|
+
targetArray.set(sourceArray);
|
|
47469
|
+
for (let i = 0; i < padLength; ++i) {
|
|
47470
|
+
dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 32);
|
|
47471
|
+
}
|
|
47472
|
+
}
|
|
47473
|
+
byteOffset += paddedLength;
|
|
47474
|
+
return byteOffset;
|
|
47475
|
+
}
|
|
47476
|
+
function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
|
|
47477
|
+
const textEncoder = new TextEncoder();
|
|
47478
|
+
const stringBuffer = textEncoder.encode(string);
|
|
47479
|
+
byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
|
|
47480
|
+
return byteOffset;
|
|
47481
|
+
}
|
|
47482
|
+
|
|
47435
47483
|
// ../loader-utils/src/lib/iterators/async-iteration.ts
|
|
47436
47484
|
async function concatenateArrayBuffersAsync(asyncIterator) {
|
|
47437
47485
|
const arrayBuffers = [];
|
|
@@ -49487,6 +49535,12 @@ async function encode(data, writer, options) {
|
|
|
49487
49535
|
}
|
|
49488
49536
|
throw new Error("Writer could not encode data");
|
|
49489
49537
|
}
|
|
49538
|
+
function encodeSync(data, writer, options) {
|
|
49539
|
+
if (writer.encodeSync) {
|
|
49540
|
+
return writer.encodeSync(data, options);
|
|
49541
|
+
}
|
|
49542
|
+
throw new Error("Writer could not synchronously encode data");
|
|
49543
|
+
}
|
|
49490
49544
|
function encodeInBatches(data, writer, options) {
|
|
49491
49545
|
if (writer.encodeInBatches) {
|
|
49492
49546
|
const dataIterator = getIterator(data);
|
|
@@ -51741,6 +51795,12 @@ var TILE3D_TYPE = {
|
|
|
51741
51795
|
GLTF: "glTF"
|
|
51742
51796
|
};
|
|
51743
51797
|
var TILE3D_TYPES = Object.keys(TILE3D_TYPE);
|
|
51798
|
+
var MAGIC_ARRAY = {
|
|
51799
|
+
BATCHED_MODEL: [98, 51, 100, 109],
|
|
51800
|
+
INSTANCED_MODEL: [105, 51, 100, 109],
|
|
51801
|
+
POINT_CLOUD: [112, 110, 116, 115],
|
|
51802
|
+
COMPOSITE: [99, 109, 112, 116]
|
|
51803
|
+
};
|
|
51744
51804
|
|
|
51745
51805
|
// ../3d-tiles/src/lib/parsers/helpers/parse-utils.ts
|
|
51746
51806
|
function getStringFromArrayBuffer(arrayBuffer, byteOffset, byteLength) {
|
|
@@ -56798,6 +56858,87 @@ async function parse3(arrayBuffer, options = {}, context) {
|
|
|
56798
56858
|
return await parseGLTF(gltf, arrayBuffer, byteOffset, options, context);
|
|
56799
56859
|
}
|
|
56800
56860
|
|
|
56861
|
+
// ../gltf/src/lib/encoders/encode-glb.ts
|
|
56862
|
+
var MAGIC_glTF2 = 1179937895;
|
|
56863
|
+
var MAGIC_JSON = 1313821514;
|
|
56864
|
+
var MAGIC_BIN = 5130562;
|
|
56865
|
+
var LE = true;
|
|
56866
|
+
function encodeGLBSync(glb, dataView, byteOffset = 0, options = {}) {
|
|
56867
|
+
const { magic = MAGIC_glTF2, version: version2 = 2, json = {}, binary } = glb;
|
|
56868
|
+
const byteOffsetStart = byteOffset;
|
|
56869
|
+
if (dataView) {
|
|
56870
|
+
dataView.setUint32(byteOffset + 0, magic, LE);
|
|
56871
|
+
dataView.setUint32(byteOffset + 4, version2, LE);
|
|
56872
|
+
dataView.setUint32(byteOffset + 8, 0, LE);
|
|
56873
|
+
}
|
|
56874
|
+
const byteOffsetFileLength = byteOffset + 8;
|
|
56875
|
+
byteOffset += 12;
|
|
56876
|
+
const byteOffsetJsonHeader = byteOffset;
|
|
56877
|
+
if (dataView) {
|
|
56878
|
+
dataView.setUint32(byteOffset + 0, 0, LE);
|
|
56879
|
+
dataView.setUint32(byteOffset + 4, MAGIC_JSON, LE);
|
|
56880
|
+
}
|
|
56881
|
+
byteOffset += 8;
|
|
56882
|
+
const jsonString = JSON.stringify(json);
|
|
56883
|
+
byteOffset = copyPaddedStringToDataView(dataView, byteOffset, jsonString, 4);
|
|
56884
|
+
if (dataView) {
|
|
56885
|
+
const jsonByteLength = byteOffset - byteOffsetJsonHeader - 8;
|
|
56886
|
+
dataView.setUint32(byteOffsetJsonHeader + 0, jsonByteLength, LE);
|
|
56887
|
+
}
|
|
56888
|
+
if (binary) {
|
|
56889
|
+
const byteOffsetBinHeader = byteOffset;
|
|
56890
|
+
if (dataView) {
|
|
56891
|
+
dataView.setUint32(byteOffset + 0, 0, LE);
|
|
56892
|
+
dataView.setUint32(byteOffset + 4, MAGIC_BIN, LE);
|
|
56893
|
+
}
|
|
56894
|
+
byteOffset += 8;
|
|
56895
|
+
byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, binary, 4);
|
|
56896
|
+
if (dataView) {
|
|
56897
|
+
const binByteLength = byteOffset - byteOffsetBinHeader - 8;
|
|
56898
|
+
dataView.setUint32(byteOffsetBinHeader + 0, binByteLength, LE);
|
|
56899
|
+
}
|
|
56900
|
+
}
|
|
56901
|
+
if (dataView) {
|
|
56902
|
+
const fileByteLength = byteOffset - byteOffsetStart;
|
|
56903
|
+
dataView.setUint32(byteOffsetFileLength, fileByteLength, LE);
|
|
56904
|
+
}
|
|
56905
|
+
return byteOffset;
|
|
56906
|
+
}
|
|
56907
|
+
|
|
56908
|
+
// ../gltf/src/lib/encoders/encode-gltf.ts
|
|
56909
|
+
function encodeGLTFSync(gltf, arrayBuffer, byteOffset, options) {
|
|
56910
|
+
convertBuffersToBase64(gltf);
|
|
56911
|
+
return encodeGLBSync(gltf, arrayBuffer, byteOffset, options);
|
|
56912
|
+
}
|
|
56913
|
+
function convertBuffersToBase64(gltf, { firstBuffer = 0 } = {}) {
|
|
56914
|
+
if (gltf.buffers && gltf.buffers.length > firstBuffer) {
|
|
56915
|
+
throw new Error("encodeGLTF: multiple buffers not yet implemented");
|
|
56916
|
+
}
|
|
56917
|
+
}
|
|
56918
|
+
|
|
56919
|
+
// ../gltf/src/gltf-writer.ts
|
|
56920
|
+
var GLTFWriter = {
|
|
56921
|
+
name: "glTF",
|
|
56922
|
+
id: "gltf",
|
|
56923
|
+
module: "gltf",
|
|
56924
|
+
version: VERSION8,
|
|
56925
|
+
extensions: ["glb"],
|
|
56926
|
+
mimeTypes: ["model/gltf-binary"],
|
|
56927
|
+
binary: true,
|
|
56928
|
+
encodeSync: encodeSync2,
|
|
56929
|
+
options: {
|
|
56930
|
+
gltf: {}
|
|
56931
|
+
}
|
|
56932
|
+
};
|
|
56933
|
+
function encodeSync2(gltf, options = {}) {
|
|
56934
|
+
const { byteOffset = 0 } = options;
|
|
56935
|
+
const byteLength = encodeGLTFSync(gltf, null, byteOffset, options);
|
|
56936
|
+
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
56937
|
+
const dataView = new DataView(arrayBuffer);
|
|
56938
|
+
encodeGLTFSync(gltf, dataView, byteOffset, options);
|
|
56939
|
+
return arrayBuffer;
|
|
56940
|
+
}
|
|
56941
|
+
|
|
56801
56942
|
// ../gltf/src/lib/api/post-process-gltf.ts
|
|
56802
56943
|
var COMPONENTS2 = {
|
|
56803
56944
|
SCALAR: 1,
|
|
@@ -59236,7 +59377,7 @@ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
|
|
|
59236
59377
|
}
|
|
59237
59378
|
async function parseImplicitTiles(params) {
|
|
59238
59379
|
const {
|
|
59239
|
-
|
|
59380
|
+
implicitOptions,
|
|
59240
59381
|
parentData = {
|
|
59241
59382
|
mortonIndex: 0,
|
|
59242
59383
|
x: 0,
|
|
@@ -59251,7 +59392,8 @@ async function parseImplicitTiles(params) {
|
|
|
59251
59392
|
y: 0,
|
|
59252
59393
|
z: 0
|
|
59253
59394
|
},
|
|
59254
|
-
s2VolumeBox
|
|
59395
|
+
s2VolumeBox,
|
|
59396
|
+
loaderOptions
|
|
59255
59397
|
} = params;
|
|
59256
59398
|
let { subtree, level = 0 } = params;
|
|
59257
59399
|
const {
|
|
@@ -59261,30 +59403,38 @@ async function parseImplicitTiles(params) {
|
|
|
59261
59403
|
contentUrlTemplate,
|
|
59262
59404
|
subtreesUriTemplate,
|
|
59263
59405
|
basePath
|
|
59264
|
-
} =
|
|
59406
|
+
} = implicitOptions;
|
|
59265
59407
|
const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
|
|
59408
|
+
if (!maximumLevel) {
|
|
59409
|
+
dist_default2.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
|
|
59410
|
+
return tile;
|
|
59411
|
+
}
|
|
59412
|
+
const lev = level + globalData.level;
|
|
59413
|
+
if (lev > maximumLevel) {
|
|
59414
|
+
return tile;
|
|
59415
|
+
}
|
|
59266
59416
|
const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];
|
|
59417
|
+
const bitsPerTile = Math.log2(childrenPerTile);
|
|
59267
59418
|
const childX = childIndex & 1;
|
|
59268
59419
|
const childY = childIndex >> 1 & 1;
|
|
59269
59420
|
const childZ = childIndex >> 2 & 1;
|
|
59270
59421
|
const levelOffset = (childrenPerTile ** level - 1) / (childrenPerTile - 1);
|
|
59271
|
-
let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex);
|
|
59422
|
+
let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex, bitsPerTile);
|
|
59272
59423
|
let tileAvailabilityIndex = levelOffset + childTileMortonIndex;
|
|
59273
|
-
let childTileX = concatBits(parentData.x, childX);
|
|
59274
|
-
let childTileY = concatBits(parentData.y, childY);
|
|
59275
|
-
let childTileZ = concatBits(parentData.z, childZ);
|
|
59424
|
+
let childTileX = concatBits(parentData.x, childX, 1);
|
|
59425
|
+
let childTileY = concatBits(parentData.y, childY, 1);
|
|
59426
|
+
let childTileZ = concatBits(parentData.z, childZ, 1);
|
|
59276
59427
|
let isChildSubtreeAvailable = false;
|
|
59277
|
-
if (level
|
|
59428
|
+
if (level >= subtreeLevels) {
|
|
59278
59429
|
isChildSubtreeAvailable = getAvailabilityResult(subtree.childSubtreeAvailability, childTileMortonIndex);
|
|
59279
59430
|
}
|
|
59280
|
-
const x = concatBits(globalData.x, childTileX);
|
|
59281
|
-
const y = concatBits(globalData.y, childTileY);
|
|
59282
|
-
const z = concatBits(globalData.z, childTileZ);
|
|
59283
|
-
const lev = level + globalData.level;
|
|
59431
|
+
const x = concatBits(globalData.x, childTileX, level * bitsPerTile);
|
|
59432
|
+
const y = concatBits(globalData.y, childTileY, level * bitsPerTile);
|
|
59433
|
+
const z = concatBits(globalData.z, childTileZ, level * bitsPerTile);
|
|
59284
59434
|
if (isChildSubtreeAvailable) {
|
|
59285
59435
|
const subtreePath = `${basePath}/${subtreesUriTemplate}`;
|
|
59286
59436
|
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x, y, z);
|
|
59287
|
-
const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);
|
|
59437
|
+
const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
|
|
59288
59438
|
subtree = childSubtree;
|
|
59289
59439
|
globalData.mortonIndex = childTileMortonIndex;
|
|
59290
59440
|
globalData.x = childTileX;
|
|
@@ -59299,7 +59449,7 @@ async function parseImplicitTiles(params) {
|
|
|
59299
59449
|
level = 0;
|
|
59300
59450
|
}
|
|
59301
59451
|
const isTileAvailable = getAvailabilityResult(subtree.tileAvailability, tileAvailabilityIndex);
|
|
59302
|
-
if (!isTileAvailable
|
|
59452
|
+
if (!isTileAvailable) {
|
|
59303
59453
|
return tile;
|
|
59304
59454
|
}
|
|
59305
59455
|
const isContentAvailable = getAvailabilityResult(subtree.contentAvailability, tileAvailabilityIndex);
|
|
@@ -59312,17 +59462,18 @@ async function parseImplicitTiles(params) {
|
|
|
59312
59462
|
const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
|
|
59313
59463
|
const childTileParsed = await parseImplicitTiles({
|
|
59314
59464
|
subtree,
|
|
59315
|
-
|
|
59465
|
+
implicitOptions,
|
|
59466
|
+
loaderOptions,
|
|
59316
59467
|
parentData: pData,
|
|
59317
59468
|
childIndex: index,
|
|
59318
59469
|
level: childTileLevel,
|
|
59319
|
-
globalData,
|
|
59470
|
+
globalData: { ...globalData },
|
|
59320
59471
|
s2VolumeBox: childS2VolumeBox
|
|
59321
59472
|
});
|
|
59322
59473
|
if (childTileParsed.contentUrl || childTileParsed.children.length) {
|
|
59323
59474
|
const globalLevel = lev + 1;
|
|
59324
59475
|
const childCoordinates = { childTileX, childTileY, childTileZ };
|
|
59325
|
-
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates,
|
|
59476
|
+
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
|
|
59326
59477
|
tile.children.push(formattedTile);
|
|
59327
59478
|
}
|
|
59328
59479
|
}
|
|
@@ -59397,8 +59548,8 @@ function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoo
|
|
|
59397
59548
|
}
|
|
59398
59549
|
throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
|
|
59399
59550
|
}
|
|
59400
|
-
function concatBits(
|
|
59401
|
-
return
|
|
59551
|
+
function concatBits(higher, lower, shift) {
|
|
59552
|
+
return (higher << shift) + lower;
|
|
59402
59553
|
}
|
|
59403
59554
|
function replaceContentUrlTemplate(templateUrl, level, x, y, z) {
|
|
59404
59555
|
const mapUrl = generateMapUrl({ level, x, y, z });
|
|
@@ -59515,6 +59666,7 @@ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTil
|
|
|
59515
59666
|
const {
|
|
59516
59667
|
subdivisionScheme,
|
|
59517
59668
|
maximumLevel,
|
|
59669
|
+
availableLevels,
|
|
59518
59670
|
subtreeLevels,
|
|
59519
59671
|
subtrees: { uri: subtreesUriTemplate }
|
|
59520
59672
|
} = implicitTilingExtension;
|
|
@@ -59536,7 +59688,7 @@ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTil
|
|
|
59536
59688
|
subtreesUriTemplate,
|
|
59537
59689
|
subdivisionScheme,
|
|
59538
59690
|
subtreeLevels,
|
|
59539
|
-
maximumLevel,
|
|
59691
|
+
maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,
|
|
59540
59692
|
refine,
|
|
59541
59693
|
basePath,
|
|
59542
59694
|
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
@@ -59545,15 +59697,16 @@ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTil
|
|
|
59545
59697
|
getTileType,
|
|
59546
59698
|
getRefine
|
|
59547
59699
|
};
|
|
59548
|
-
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
|
|
59700
|
+
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);
|
|
59549
59701
|
}
|
|
59550
|
-
async function normalizeImplicitTileData(tile, basePath, rootSubtree,
|
|
59702
|
+
async function normalizeImplicitTileData(tile, basePath, rootSubtree, implicitOptions, loaderOptions) {
|
|
59551
59703
|
if (!tile) {
|
|
59552
59704
|
return null;
|
|
59553
59705
|
}
|
|
59554
59706
|
const { children, contentUrl } = await parseImplicitTiles({
|
|
59555
59707
|
subtree: rootSubtree,
|
|
59556
|
-
|
|
59708
|
+
implicitOptions,
|
|
59709
|
+
loaderOptions
|
|
59557
59710
|
});
|
|
59558
59711
|
let tileContentUrl;
|
|
59559
59712
|
let tileContent = null;
|
|
@@ -59720,6 +59873,177 @@ var CesiumIonLoader = {
|
|
|
59720
59873
|
}
|
|
59721
59874
|
};
|
|
59722
59875
|
|
|
59876
|
+
// ../3d-tiles/src/lib/encoders/helpers/encode-3d-tile-header.ts
|
|
59877
|
+
function encode3DTileHeader(tile, dataView, byteOffset) {
|
|
59878
|
+
const HEADER_SIZE = 12;
|
|
59879
|
+
if (!dataView) {
|
|
59880
|
+
return byteOffset + HEADER_SIZE;
|
|
59881
|
+
}
|
|
59882
|
+
const { magic, version: version2 = 1, byteLength = 12 } = tile;
|
|
59883
|
+
assert2(Array.isArray(magic) && Number.isFinite(version2) && Number.isFinite(byteLength));
|
|
59884
|
+
dataView.setUint8(byteOffset + 0, magic[0]);
|
|
59885
|
+
dataView.setUint8(byteOffset + 1, magic[1]);
|
|
59886
|
+
dataView.setUint8(byteOffset + 2, magic[2]);
|
|
59887
|
+
dataView.setUint8(byteOffset + 3, magic[3]);
|
|
59888
|
+
dataView.setUint32(byteOffset + 4, version2, true);
|
|
59889
|
+
dataView.setUint32(byteOffset + 8, byteLength, true);
|
|
59890
|
+
byteOffset += HEADER_SIZE;
|
|
59891
|
+
return byteOffset;
|
|
59892
|
+
}
|
|
59893
|
+
function encode3DTileByteLength(dataView, byteOffsetTileStart, byteLength) {
|
|
59894
|
+
if (!dataView) {
|
|
59895
|
+
return;
|
|
59896
|
+
}
|
|
59897
|
+
dataView.setUint32(byteOffsetTileStart + 8, byteLength, true);
|
|
59898
|
+
}
|
|
59899
|
+
|
|
59900
|
+
// ../3d-tiles/src/lib/encoders/encode-3d-tile-composite.ts
|
|
59901
|
+
function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile2) {
|
|
59902
|
+
tile = { magic: MAGIC_ARRAY.COMPOSITE, tiles: [], ...tile };
|
|
59903
|
+
const byteOffsetStart = byteOffset;
|
|
59904
|
+
byteOffset += encode3DTileHeader(tile, dataView, byteOffset);
|
|
59905
|
+
if (dataView) {
|
|
59906
|
+
dataView.setUint32(byteOffset, tile.tiles.length, true);
|
|
59907
|
+
}
|
|
59908
|
+
byteOffset += 4;
|
|
59909
|
+
for (let i = 0; i < tile.tiles.length; ++i) {
|
|
59910
|
+
byteOffset += encode3DTile2(tile.tiles[i], dataView, byteOffset, options);
|
|
59911
|
+
}
|
|
59912
|
+
encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
|
|
59913
|
+
return byteOffset;
|
|
59914
|
+
}
|
|
59915
|
+
|
|
59916
|
+
// ../3d-tiles/src/lib/encoders/encode-3d-tile-batched-model.ts
|
|
59917
|
+
function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
|
|
59918
|
+
const { featuresLength = 0, batchTable } = tile;
|
|
59919
|
+
const featureTableJson = {
|
|
59920
|
+
BATCH_LENGTH: featuresLength
|
|
59921
|
+
};
|
|
59922
|
+
const featureTableJsonString = JSON.stringify(featureTableJson);
|
|
59923
|
+
const batchTableJsonString = batchTable ? JSON.stringify(batchTable) : "";
|
|
59924
|
+
const featureTableJsonByteLength = padToNBytes(featureTableJsonString.length, 8);
|
|
59925
|
+
const batchTableJsonByteLength = batchTableJsonString ? padToNBytes(batchTableJsonString.length, 8) : 0;
|
|
59926
|
+
tile = { magic: MAGIC_ARRAY.BATCHED_MODEL, ...tile };
|
|
59927
|
+
const byteOffsetStart = byteOffset;
|
|
59928
|
+
byteOffset = encode3DTileHeader(tile, dataView, byteOffset);
|
|
59929
|
+
if (dataView) {
|
|
59930
|
+
dataView.setUint32(12, featureTableJsonByteLength, true);
|
|
59931
|
+
dataView.setUint32(16, 0, true);
|
|
59932
|
+
dataView.setUint32(20, batchTableJsonByteLength, true);
|
|
59933
|
+
dataView.setUint32(24, 0, true);
|
|
59934
|
+
}
|
|
59935
|
+
byteOffset += 16;
|
|
59936
|
+
byteOffset = copyPaddedStringToDataView(dataView, byteOffset, featureTableJsonString, 8);
|
|
59937
|
+
if (batchTable) {
|
|
59938
|
+
byteOffset = copyPaddedStringToDataView(dataView, byteOffset, batchTableJsonString, 8);
|
|
59939
|
+
}
|
|
59940
|
+
const gltfEncoded = tile.gltfEncoded;
|
|
59941
|
+
if (gltfEncoded) {
|
|
59942
|
+
byteOffset = copyBinaryToDataView(dataView, byteOffset, gltfEncoded, gltfEncoded.byteLength);
|
|
59943
|
+
}
|
|
59944
|
+
encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
|
|
59945
|
+
return byteOffset;
|
|
59946
|
+
}
|
|
59947
|
+
|
|
59948
|
+
// ../3d-tiles/src/lib/encoders/encode-3d-tile-instanced-model.ts
|
|
59949
|
+
function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
|
|
59950
|
+
const { featuresLength = 1, gltfFormat = 1, gltfUri = "" } = tile;
|
|
59951
|
+
const gltfUriByteLength = gltfUri.length;
|
|
59952
|
+
const featureTableJson = {
|
|
59953
|
+
INSTANCES_LENGTH: featuresLength,
|
|
59954
|
+
POSITION: new Array(featuresLength * 3).fill(0)
|
|
59955
|
+
};
|
|
59956
|
+
const featureTableJsonString = JSON.stringify(featureTableJson);
|
|
59957
|
+
const featureTableJsonByteLength = featureTableJsonString.length;
|
|
59958
|
+
tile = { magic: MAGIC_ARRAY.INSTANCED_MODEL, ...tile };
|
|
59959
|
+
const byteOffsetStart = byteOffset;
|
|
59960
|
+
byteOffset = encode3DTileHeader(tile, dataView, 0);
|
|
59961
|
+
if (dataView) {
|
|
59962
|
+
dataView.setUint32(12, featureTableJsonByteLength, true);
|
|
59963
|
+
dataView.setUint32(16, 0, true);
|
|
59964
|
+
dataView.setUint32(20, 0, true);
|
|
59965
|
+
dataView.setUint32(24, 0, true);
|
|
59966
|
+
dataView.setUint32(28, gltfFormat, true);
|
|
59967
|
+
}
|
|
59968
|
+
byteOffset += 20;
|
|
59969
|
+
byteOffset += copyStringToDataView(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
|
|
59970
|
+
byteOffset += copyStringToDataView(dataView, byteOffset, gltfUri, gltfUriByteLength);
|
|
59971
|
+
encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
|
|
59972
|
+
return byteOffset;
|
|
59973
|
+
}
|
|
59974
|
+
|
|
59975
|
+
// ../3d-tiles/src/lib/encoders/encode-3d-tile-point-cloud.ts
|
|
59976
|
+
var DEFAULT_FEATURE_TABLE_JSON = {
|
|
59977
|
+
POINTS_LENGTH: 1,
|
|
59978
|
+
POSITIONS: {
|
|
59979
|
+
byteOffset: 0
|
|
59980
|
+
}
|
|
59981
|
+
};
|
|
59982
|
+
function encodePointCloud3DTile(tile, dataView, byteOffset, options) {
|
|
59983
|
+
const { featureTableJson = DEFAULT_FEATURE_TABLE_JSON } = tile;
|
|
59984
|
+
let featureTableJsonString = JSON.stringify(featureTableJson);
|
|
59985
|
+
featureTableJsonString = padStringToByteAlignment(featureTableJsonString, 4);
|
|
59986
|
+
const { featureTableJsonByteLength = featureTableJsonString.length } = tile;
|
|
59987
|
+
const featureTableBinary = new ArrayBuffer(12);
|
|
59988
|
+
const featureTableBinaryByteLength = featureTableBinary.byteLength;
|
|
59989
|
+
tile = { magic: MAGIC_ARRAY.POINT_CLOUD, ...tile };
|
|
59990
|
+
const byteOffsetStart = byteOffset;
|
|
59991
|
+
byteOffset += encode3DTileHeader(tile, dataView, 0);
|
|
59992
|
+
if (dataView) {
|
|
59993
|
+
dataView.setUint32(byteOffset + 0, featureTableJsonByteLength, true);
|
|
59994
|
+
dataView.setUint32(byteOffset + 4, featureTableBinaryByteLength, true);
|
|
59995
|
+
dataView.setUint32(byteOffset + 8, 0, true);
|
|
59996
|
+
dataView.setUint32(byteOffset + 12, 0, true);
|
|
59997
|
+
}
|
|
59998
|
+
byteOffset += 16;
|
|
59999
|
+
byteOffset += copyStringToDataView(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
|
|
60000
|
+
byteOffset += copyBinaryToDataView(dataView, byteOffset, featureTableBinary, featureTableBinaryByteLength);
|
|
60001
|
+
encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
|
|
60002
|
+
return byteOffset;
|
|
60003
|
+
}
|
|
60004
|
+
|
|
60005
|
+
// ../3d-tiles/src/lib/encoders/encode-3d-tile.ts
|
|
60006
|
+
function encode3DTile(tile, options) {
|
|
60007
|
+
const byteLength = encode3DTileToDataView(tile, null, 0, options);
|
|
60008
|
+
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
60009
|
+
const dataView = new DataView(arrayBuffer);
|
|
60010
|
+
encode3DTileToDataView(tile, dataView, 0, options);
|
|
60011
|
+
return arrayBuffer;
|
|
60012
|
+
}
|
|
60013
|
+
function encode3DTileToDataView(tile, dataView, byteOffset, options) {
|
|
60014
|
+
assert2(typeof tile.type === "string");
|
|
60015
|
+
switch (tile.type) {
|
|
60016
|
+
case TILE3D_TYPE.COMPOSITE:
|
|
60017
|
+
return encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTileToDataView);
|
|
60018
|
+
case TILE3D_TYPE.POINT_CLOUD:
|
|
60019
|
+
return encodePointCloud3DTile(tile, dataView, byteOffset, options);
|
|
60020
|
+
case TILE3D_TYPE.BATCHED_3D_MODEL:
|
|
60021
|
+
return encodeBatchedModel3DTile(tile, dataView, byteOffset, options);
|
|
60022
|
+
case TILE3D_TYPE.INSTANCED_3D_MODEL:
|
|
60023
|
+
return encodeInstancedModel3DTile(tile, dataView, byteOffset, options);
|
|
60024
|
+
default:
|
|
60025
|
+
throw new Error("3D Tiles: unknown tile type");
|
|
60026
|
+
}
|
|
60027
|
+
}
|
|
60028
|
+
|
|
60029
|
+
// ../3d-tiles/src/tile-3d-writer.ts
|
|
60030
|
+
var Tile3DWriter = {
|
|
60031
|
+
name: "3D Tile",
|
|
60032
|
+
id: "3d-tiles",
|
|
60033
|
+
module: "3d-tiles",
|
|
60034
|
+
version: VERSION6,
|
|
60035
|
+
extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
|
|
60036
|
+
mimeTypes: ["application/octet-stream"],
|
|
60037
|
+
encodeSync: encodeSync3,
|
|
60038
|
+
binary: true,
|
|
60039
|
+
options: {
|
|
60040
|
+
["3d-tiles"]: {}
|
|
60041
|
+
}
|
|
60042
|
+
};
|
|
60043
|
+
function encodeSync3(tile, options) {
|
|
60044
|
+
return encode3DTile(tile, options);
|
|
60045
|
+
}
|
|
60046
|
+
|
|
59723
60047
|
// src/i3s-converter/i3s-converter.ts
|
|
59724
60048
|
var import_path8 = __toModule(require("path"));
|
|
59725
60049
|
|
|
@@ -62300,18 +62624,6 @@ var WriteQueue = class extends Queue {
|
|
|
62300
62624
|
}
|
|
62301
62625
|
};
|
|
62302
62626
|
|
|
62303
|
-
// src/i3s-attributes-worker.ts
|
|
62304
|
-
var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
62305
|
-
var I3SAttributesWorker = {
|
|
62306
|
-
id: "i3s-attributes",
|
|
62307
|
-
name: "I3S Attributes Worker",
|
|
62308
|
-
module: "tile-converter",
|
|
62309
|
-
version: VERSION14,
|
|
62310
|
-
options: {
|
|
62311
|
-
useCartesianPositions: false
|
|
62312
|
-
}
|
|
62313
|
-
};
|
|
62314
|
-
|
|
62315
62627
|
// src/constants.ts
|
|
62316
62628
|
var BROWSER_ERROR_MESSAGE = "Tile converter does not work in browser, only in node js environment";
|
|
62317
62629
|
|
|
@@ -63322,20 +63634,16 @@ var I3SConverter = class {
|
|
|
63322
63634
|
console.log(`Loading workers source...`);
|
|
63323
63635
|
if (this.options.draco) {
|
|
63324
63636
|
const url = getWorkerURL(DracoWriterWorker, { ...getGlobalLoaderOptions() });
|
|
63325
|
-
const
|
|
63326
|
-
const
|
|
63327
|
-
this.workerSource.draco =
|
|
63637
|
+
const sourceResponse = await fetchFile(url);
|
|
63638
|
+
const source = await sourceResponse.text();
|
|
63639
|
+
this.workerSource.draco = source;
|
|
63328
63640
|
}
|
|
63329
63641
|
if (this.generateTextures) {
|
|
63330
63642
|
const url = getWorkerURL(KTX2BasisWriterWorker, { ...getGlobalLoaderOptions() });
|
|
63331
|
-
const
|
|
63332
|
-
const
|
|
63333
|
-
this.workerSource.ktx2 =
|
|
63334
|
-
}
|
|
63335
|
-
const i3sAttributesWorkerUrl = getWorkerURL(I3SAttributesWorker, { ...getGlobalLoaderOptions() });
|
|
63336
|
-
const sourceResponse = await fetchFile(i3sAttributesWorkerUrl);
|
|
63337
|
-
const source = await sourceResponse.text();
|
|
63338
|
-
this.workerSource.I3SAttributes = source;
|
|
63643
|
+
const sourceResponse = await fetchFile(url);
|
|
63644
|
+
const source = await sourceResponse.text();
|
|
63645
|
+
this.workerSource.ktx2 = source;
|
|
63646
|
+
}
|
|
63339
63647
|
console.log(`Loading workers source completed!`);
|
|
63340
63648
|
}
|
|
63341
63649
|
};
|
|
@@ -63346,7 +63654,7 @@ var import_process3 = __toModule(require("process"));
|
|
|
63346
63654
|
var import_json_map_transform10 = __toModule(require_json_map_transform());
|
|
63347
63655
|
|
|
63348
63656
|
// ../i3s/src/lib/parsers/constants.ts
|
|
63349
|
-
var
|
|
63657
|
+
var import_constants15 = __toModule(require_es55());
|
|
63350
63658
|
|
|
63351
63659
|
// ../i3s/src/types.ts
|
|
63352
63660
|
var DATA_TYPE;
|
|
@@ -63385,11 +63693,11 @@ function getConstructorForDataFormat(dataType) {
|
|
|
63385
63693
|
}
|
|
63386
63694
|
}
|
|
63387
63695
|
var GL_TYPE_MAP = {
|
|
63388
|
-
UInt8:
|
|
63389
|
-
UInt16:
|
|
63390
|
-
Float32:
|
|
63391
|
-
UInt32:
|
|
63392
|
-
UInt64:
|
|
63696
|
+
UInt8: import_constants15.default.UNSIGNED_BYTE,
|
|
63697
|
+
UInt16: import_constants15.default.UNSIGNED_SHORT,
|
|
63698
|
+
Float32: import_constants15.default.FLOAT,
|
|
63699
|
+
UInt32: import_constants15.default.UNSIGNED_INT,
|
|
63700
|
+
UInt64: import_constants15.default.DOUBLE
|
|
63393
63701
|
};
|
|
63394
63702
|
function sizeOf(dataType) {
|
|
63395
63703
|
switch (dataType) {
|
|
@@ -63508,12 +63816,12 @@ function parseStringsAttribute(arrayBuffer) {
|
|
|
63508
63816
|
}
|
|
63509
63817
|
|
|
63510
63818
|
// ../i3s/src/i3s-attribute-loader.ts
|
|
63511
|
-
var
|
|
63819
|
+
var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
63512
63820
|
var I3SAttributeLoader = {
|
|
63513
63821
|
name: "I3S Attribute",
|
|
63514
63822
|
id: "i3s-attribute",
|
|
63515
63823
|
module: "i3s",
|
|
63516
|
-
version:
|
|
63824
|
+
version: VERSION14,
|
|
63517
63825
|
mimeTypes: ["application/binary"],
|
|
63518
63826
|
parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
|
|
63519
63827
|
extensions: ["bin"],
|
|
@@ -63971,13 +64279,13 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
|
|
|
63971
64279
|
}
|
|
63972
64280
|
|
|
63973
64281
|
// ../i3s/src/i3s-content-loader.ts
|
|
63974
|
-
var
|
|
64282
|
+
var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
63975
64283
|
var I3SContentLoader = {
|
|
63976
64284
|
name: "I3S Content (Indexed Scene Layers)",
|
|
63977
64285
|
id: "i3s-content",
|
|
63978
64286
|
module: "i3s",
|
|
63979
64287
|
worker: true,
|
|
63980
|
-
version:
|
|
64288
|
+
version: VERSION15,
|
|
63981
64289
|
mimeTypes: ["application/octet-stream"],
|
|
63982
64290
|
parse: parse6,
|
|
63983
64291
|
extensions: ["bin"],
|
|
@@ -64000,7 +64308,7 @@ var import_culling8 = __toModule(require_es53());
|
|
|
64000
64308
|
var import_geospatial14 = __toModule(require_es52());
|
|
64001
64309
|
|
|
64002
64310
|
// ../i3s/src/i3s-node-page-loader.ts
|
|
64003
|
-
var
|
|
64311
|
+
var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
64004
64312
|
async function parseNodePage(data, options) {
|
|
64005
64313
|
return JSON.parse(new TextDecoder().decode(data));
|
|
64006
64314
|
}
|
|
@@ -64008,7 +64316,7 @@ var I3SNodePageLoader = {
|
|
|
64008
64316
|
name: "I3S Node Page",
|
|
64009
64317
|
id: "i3s-node-page",
|
|
64010
64318
|
module: "i3s",
|
|
64011
|
-
version:
|
|
64319
|
+
version: VERSION16,
|
|
64012
64320
|
mimeTypes: ["application/json"],
|
|
64013
64321
|
parse: parseNodePage,
|
|
64014
64322
|
extensions: ["json"],
|
|
@@ -64260,7 +64568,7 @@ async function normalizeTilesetData(tileset, options, context) {
|
|
|
64260
64568
|
}
|
|
64261
64569
|
|
|
64262
64570
|
// ../i3s/src/i3s-loader.ts
|
|
64263
|
-
var
|
|
64571
|
+
var VERSION17 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
64264
64572
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
64265
64573
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
64266
64574
|
var SLPK_HEX = "504b0304";
|
|
@@ -64269,7 +64577,7 @@ var I3SLoader = {
|
|
|
64269
64577
|
name: "I3S (Indexed Scene Layers)",
|
|
64270
64578
|
id: "i3s",
|
|
64271
64579
|
module: "i3s",
|
|
64272
|
-
version:
|
|
64580
|
+
version: VERSION17,
|
|
64273
64581
|
mimeTypes: ["application/octet-stream"],
|
|
64274
64582
|
parse: parseI3S,
|
|
64275
64583
|
extensions: ["bin"],
|
|
@@ -64394,20 +64702,226 @@ var TILESET = () => ({
|
|
|
64394
64702
|
}
|
|
64395
64703
|
});
|
|
64396
64704
|
|
|
64397
|
-
// src/3d-tiles-
|
|
64398
|
-
var
|
|
64399
|
-
var
|
|
64400
|
-
|
|
64401
|
-
|
|
64402
|
-
|
|
64403
|
-
|
|
64404
|
-
|
|
64405
|
-
|
|
64705
|
+
// src/3d-tiles-converter/helpers/b3dm-converter.ts
|
|
64706
|
+
var import_core40 = __toModule(require_es5());
|
|
64707
|
+
var import_geospatial16 = __toModule(require_es52());
|
|
64708
|
+
|
|
64709
|
+
// src/3d-tiles-converter/helpers/texture-atlas.ts
|
|
64710
|
+
function convertTextureAtlas(texCoords, uvRegions) {
|
|
64711
|
+
const convertedTexCoords = new Float32Array(texCoords.length);
|
|
64712
|
+
const normalisedRegions = normalizeRegions(uvRegions);
|
|
64713
|
+
for (let index = 0; index < texCoords.length; index += 2) {
|
|
64714
|
+
const uv = texCoords.subarray(index, index + 2);
|
|
64715
|
+
const regions = normalisedRegions.slice(index * 2, index * 2 + 4);
|
|
64716
|
+
const fractatedUV = fract([uv[0], uv[1]]);
|
|
64717
|
+
const subtracted = [regions[2] - regions[0], regions[3] - regions[1]];
|
|
64718
|
+
const multiplicationResult = [fractatedUV[0] * subtracted[0], fractatedUV[1] * subtracted[1]];
|
|
64719
|
+
const convertedUV = [
|
|
64720
|
+
multiplicationResult[0] + regions[0],
|
|
64721
|
+
multiplicationResult[1] + regions[1]
|
|
64722
|
+
];
|
|
64723
|
+
convertedTexCoords[index] = convertedUV[0];
|
|
64724
|
+
convertedTexCoords[index + 1] = convertedUV[1];
|
|
64725
|
+
}
|
|
64726
|
+
return convertedTexCoords;
|
|
64727
|
+
}
|
|
64728
|
+
function fract(uv) {
|
|
64729
|
+
return [uv[0] - Math.floor(uv[0]), uv[1] - Math.floor(uv[1])];
|
|
64730
|
+
}
|
|
64731
|
+
function normalizeRegions(regions) {
|
|
64732
|
+
const MAX_UINT_16_VALUE = 65535;
|
|
64733
|
+
const normalizedRegions = [];
|
|
64734
|
+
for (let index = 0; index < regions.length; index++) {
|
|
64735
|
+
normalizedRegions[index] = regions[index] / MAX_UINT_16_VALUE;
|
|
64736
|
+
}
|
|
64737
|
+
return normalizedRegions;
|
|
64738
|
+
}
|
|
64739
|
+
|
|
64740
|
+
// src/3d-tiles-converter/helpers/b3dm-converter.ts
|
|
64741
|
+
var Z_UP_TO_Y_UP_MATRIX = new import_core40.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
|
|
64742
|
+
var scratchVector7 = new import_core40.Vector3();
|
|
64743
|
+
var B3dmConverter = class {
|
|
64744
|
+
async convert(i3sAttributesData, featureAttributes = null) {
|
|
64745
|
+
const gltf = await this.buildGltf(i3sAttributesData, featureAttributes);
|
|
64746
|
+
const b3dm = encodeSync({
|
|
64747
|
+
gltfEncoded: new Uint8Array(gltf),
|
|
64748
|
+
type: "b3dm",
|
|
64749
|
+
featuresLength: this._getFeaturesLength(featureAttributes),
|
|
64750
|
+
batchTable: featureAttributes
|
|
64751
|
+
}, Tile3DWriter);
|
|
64752
|
+
return b3dm;
|
|
64753
|
+
}
|
|
64754
|
+
async buildGltf(i3sAttributesData, featureAttributes) {
|
|
64755
|
+
const { tileContent, textureFormat } = i3sAttributesData;
|
|
64756
|
+
const {
|
|
64757
|
+
material,
|
|
64758
|
+
attributes,
|
|
64759
|
+
indices: originalIndices,
|
|
64760
|
+
cartesianOrigin,
|
|
64761
|
+
cartographicOrigin,
|
|
64762
|
+
modelMatrix
|
|
64763
|
+
} = tileContent;
|
|
64764
|
+
const gltfBuilder = new GLTFScenegraph();
|
|
64765
|
+
const textureIndex = await this._addI3sTextureToGltf(tileContent, textureFormat, gltfBuilder);
|
|
64766
|
+
const pbrMaterialInfo = this._convertI3sMaterialToGltfMaterial(material, textureIndex);
|
|
64767
|
+
const materialIndex = gltfBuilder.addMaterial(pbrMaterialInfo);
|
|
64768
|
+
const positions = attributes.positions;
|
|
64769
|
+
const positionsValue = positions.value;
|
|
64770
|
+
if (attributes.uvRegions && attributes.texCoords) {
|
|
64771
|
+
attributes.texCoords.value = convertTextureAtlas(attributes.texCoords.value, attributes.uvRegions.value);
|
|
64772
|
+
}
|
|
64773
|
+
attributes.positions.value = this._normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix);
|
|
64774
|
+
this._createBatchIds(tileContent, featureAttributes);
|
|
64775
|
+
if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
|
|
64776
|
+
delete attributes.normals;
|
|
64777
|
+
}
|
|
64778
|
+
const indices = originalIndices || generateSyntheticIndices(positionsValue.length / positions.size);
|
|
64779
|
+
const meshIndex = gltfBuilder.addMesh({
|
|
64780
|
+
attributes,
|
|
64781
|
+
indices,
|
|
64782
|
+
material: materialIndex,
|
|
64783
|
+
mode: 4
|
|
64784
|
+
});
|
|
64785
|
+
const transformMatrix = this._generateTransformMatrix(cartesianOrigin);
|
|
64786
|
+
const nodeIndex = gltfBuilder.addNode({ meshIndex, matrix: transformMatrix });
|
|
64787
|
+
const sceneIndex = gltfBuilder.addScene({ nodeIndices: [nodeIndex] });
|
|
64788
|
+
gltfBuilder.setDefaultScene(sceneIndex);
|
|
64789
|
+
gltfBuilder.createBinaryChunk();
|
|
64790
|
+
const gltfBuffer = encodeSync(gltfBuilder.gltf, GLTFWriter);
|
|
64791
|
+
return gltfBuffer;
|
|
64792
|
+
}
|
|
64793
|
+
async _addI3sTextureToGltf(tileContent, textureFormat, gltfBuilder) {
|
|
64794
|
+
const { texture, material, attributes } = tileContent;
|
|
64795
|
+
let textureIndex = null;
|
|
64796
|
+
let selectedTexture = texture;
|
|
64797
|
+
if (!texture && material) {
|
|
64798
|
+
selectedTexture = material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture && material.pbrMetallicRoughness.baseColorTexture.texture.source.image;
|
|
64799
|
+
}
|
|
64800
|
+
if (selectedTexture) {
|
|
64801
|
+
const mimeType = this._deduceMimeTypeFromFormat(textureFormat);
|
|
64802
|
+
const imageIndex = gltfBuilder.addImage(selectedTexture, mimeType);
|
|
64803
|
+
textureIndex = gltfBuilder.addTexture({ imageIndex });
|
|
64804
|
+
delete attributes.colors;
|
|
64805
|
+
}
|
|
64806
|
+
return textureIndex;
|
|
64807
|
+
}
|
|
64808
|
+
_normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix) {
|
|
64809
|
+
const newPositionsValue = new Float32Array(positionsValue.length);
|
|
64810
|
+
for (let index = 0; index < positionsValue.length; index += 3) {
|
|
64811
|
+
const vertex = positionsValue.subarray(index, index + 3);
|
|
64812
|
+
const cartesianOriginVector = new import_core40.Vector3(cartesianOrigin);
|
|
64813
|
+
let vertexVector = new import_core40.Vector3(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
|
|
64814
|
+
import_geospatial16.Ellipsoid.WGS84.cartographicToCartesian(vertexVector, scratchVector7);
|
|
64815
|
+
vertexVector = scratchVector7.subtract(cartesianOriginVector);
|
|
64816
|
+
newPositionsValue.set(vertexVector, index);
|
|
64817
|
+
}
|
|
64818
|
+
return newPositionsValue;
|
|
64819
|
+
}
|
|
64820
|
+
_generateTransformMatrix(cartesianOrigin) {
|
|
64821
|
+
const translateOriginMatrix = new import_core40.Matrix4().translate(cartesianOrigin);
|
|
64822
|
+
const result = translateOriginMatrix.multiplyLeft(Z_UP_TO_Y_UP_MATRIX);
|
|
64823
|
+
return result;
|
|
64824
|
+
}
|
|
64825
|
+
_createBatchIds(i3sContent, featureAttributes) {
|
|
64826
|
+
const { featureIds } = i3sContent;
|
|
64827
|
+
const { OBJECTID: objectIds } = featureAttributes || {};
|
|
64828
|
+
if (!featureIds || !objectIds) {
|
|
64829
|
+
return;
|
|
64830
|
+
}
|
|
64831
|
+
for (let i = 0; i < featureIds.length; i++) {
|
|
64832
|
+
const featureId = featureIds[i];
|
|
64833
|
+
const batchId = objectIds.indexOf(featureId);
|
|
64834
|
+
featureIds[i] = batchId;
|
|
64835
|
+
}
|
|
64836
|
+
i3sContent.attributes._BATCHID = {
|
|
64837
|
+
size: 1,
|
|
64838
|
+
byteOffset: 0,
|
|
64839
|
+
value: featureIds
|
|
64840
|
+
};
|
|
64841
|
+
}
|
|
64842
|
+
_deduceMimeTypeFromFormat(format) {
|
|
64843
|
+
switch (format) {
|
|
64844
|
+
case "jpg":
|
|
64845
|
+
return "image/jpeg";
|
|
64846
|
+
case "png":
|
|
64847
|
+
return "image/png";
|
|
64848
|
+
case "ktx2":
|
|
64849
|
+
return "image/ktx2";
|
|
64850
|
+
default:
|
|
64851
|
+
console.warn(`Unexpected texture format in I3S: ${format}`);
|
|
64852
|
+
return "image/jpeg";
|
|
64853
|
+
}
|
|
64854
|
+
}
|
|
64855
|
+
_convertI3sMaterialToGltfMaterial(material, textureIndex) {
|
|
64856
|
+
const isTextureIndexExists = textureIndex !== null;
|
|
64857
|
+
if (!material) {
|
|
64858
|
+
material = {
|
|
64859
|
+
alphaMode: "OPAQUE",
|
|
64860
|
+
doubleSided: false,
|
|
64861
|
+
pbrMetallicRoughness: {
|
|
64862
|
+
metallicFactor: 0,
|
|
64863
|
+
roughnessFactor: 1
|
|
64864
|
+
}
|
|
64865
|
+
};
|
|
64866
|
+
if (isTextureIndexExists) {
|
|
64867
|
+
material.pbrMetallicRoughness.baseColorTexture = {
|
|
64868
|
+
index: textureIndex,
|
|
64869
|
+
texCoord: 0
|
|
64870
|
+
};
|
|
64871
|
+
} else {
|
|
64872
|
+
material.pbrMetallicRoughness.baseColorFactor = [1, 1, 1, 1];
|
|
64873
|
+
}
|
|
64874
|
+
return material;
|
|
64875
|
+
}
|
|
64876
|
+
if (textureIndex !== null) {
|
|
64877
|
+
material = this._setGltfTexture(material, textureIndex);
|
|
64878
|
+
}
|
|
64879
|
+
return material;
|
|
64880
|
+
}
|
|
64881
|
+
_setGltfTexture(materialDefinition, textureIndex) {
|
|
64882
|
+
const material = {
|
|
64883
|
+
...materialDefinition,
|
|
64884
|
+
pbrMetallicRoughness: { ...materialDefinition.pbrMetallicRoughness }
|
|
64885
|
+
};
|
|
64886
|
+
if (materialDefinition.pbrMetallicRoughness && materialDefinition.pbrMetallicRoughness.baseColorTexture) {
|
|
64887
|
+
material.pbrMetallicRoughness.baseColorTexture = {
|
|
64888
|
+
index: textureIndex,
|
|
64889
|
+
texCoord: 0
|
|
64890
|
+
};
|
|
64891
|
+
} else if (materialDefinition.emissiveTexture) {
|
|
64892
|
+
material.emissiveTexture = {
|
|
64893
|
+
index: textureIndex,
|
|
64894
|
+
texCoord: 0
|
|
64895
|
+
};
|
|
64896
|
+
} else if (materialDefinition.pbrMetallicRoughness && materialDefinition.pbrMetallicRoughness.metallicRoughnessTexture) {
|
|
64897
|
+
material.pbrMetallicRoughness.metallicRoughnessTexture = {
|
|
64898
|
+
index: textureIndex,
|
|
64899
|
+
texCoord: 0
|
|
64900
|
+
};
|
|
64901
|
+
} else if (materialDefinition.normalTexture) {
|
|
64902
|
+
material.normalTexture = {
|
|
64903
|
+
index: textureIndex,
|
|
64904
|
+
texCoord: 0
|
|
64905
|
+
};
|
|
64906
|
+
} else if (materialDefinition.occlusionTexture) {
|
|
64907
|
+
material.occlusionTexture = {
|
|
64908
|
+
index: textureIndex,
|
|
64909
|
+
texCoord: 0
|
|
64910
|
+
};
|
|
64911
|
+
}
|
|
64912
|
+
return material;
|
|
64913
|
+
}
|
|
64914
|
+
_getFeaturesLength(attributes) {
|
|
64915
|
+
if (!attributes) {
|
|
64916
|
+
return 0;
|
|
64917
|
+
}
|
|
64918
|
+
const firstKey = Object.keys(attributes)[0];
|
|
64919
|
+
return firstKey ? attributes[firstKey].length : 0;
|
|
64920
|
+
}
|
|
64921
|
+
_checkNormals(normals) {
|
|
64922
|
+
return normals.find((value) => value);
|
|
64406
64923
|
}
|
|
64407
64924
|
};
|
|
64408
|
-
function transform3DTilesAttributesOnWorker(i3sAttributesData, options) {
|
|
64409
|
-
return processOnWorker(Tile3dAttributesWorker, i3sAttributesData, options);
|
|
64410
|
-
}
|
|
64411
64925
|
|
|
64412
64926
|
// src/3d-tiles-converter/3d-tiles-converter.ts
|
|
64413
64927
|
var I3S = "I3S";
|
|
@@ -64434,13 +64948,15 @@ var Tiles3DConverter = class {
|
|
|
64434
64948
|
console.log("Loading egm file...");
|
|
64435
64949
|
this.geoidHeightModel = await load(egmFilePath, PGMLoader);
|
|
64436
64950
|
console.log("Loading egm file completed!");
|
|
64437
|
-
await this.loadWorkers();
|
|
64438
64951
|
const sourceTilesetJson = await load(inputUrl, I3SLoader, {});
|
|
64439
64952
|
this.sourceTileset = new Tileset3D(sourceTilesetJson, {
|
|
64440
64953
|
loadOptions: {
|
|
64441
64954
|
_nodeWorkers: true,
|
|
64442
64955
|
reuseWorkers: true,
|
|
64443
|
-
i3s: { coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false }
|
|
64956
|
+
i3s: { coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false },
|
|
64957
|
+
"i3s-content": {
|
|
64958
|
+
workerUrl: "./modules/i3s/dist/i3s-content-worker-node.js"
|
|
64959
|
+
}
|
|
64444
64960
|
}
|
|
64445
64961
|
});
|
|
64446
64962
|
await this.sourceTileset.tilesetInitializationPromise;
|
|
@@ -64493,10 +65009,8 @@ var Tiles3DConverter = class {
|
|
|
64493
65009
|
tileContent: sourceChild.content,
|
|
64494
65010
|
textureFormat: sourceChild?.header?.textureFormat
|
|
64495
65011
|
};
|
|
64496
|
-
const
|
|
64497
|
-
|
|
64498
|
-
featureAttributes
|
|
64499
|
-
});
|
|
65012
|
+
const b3dmConverter = new B3dmConverter();
|
|
65013
|
+
const b3dm = await b3dmConverter.convert(i3sAttributesData, featureAttributes);
|
|
64500
65014
|
child.content = {
|
|
64501
65015
|
uri: `${sourceChild.id}.b3dm`,
|
|
64502
65016
|
boundingVolume
|
|
@@ -64598,14 +65112,6 @@ var Tiles3DConverter = class {
|
|
|
64598
65112
|
console.log(`File(s) size: `, filesSize, " bytes");
|
|
64599
65113
|
console.log(`------------------------------------------------`);
|
|
64600
65114
|
}
|
|
64601
|
-
async loadWorkers() {
|
|
64602
|
-
console.log(`Loading workers source...`);
|
|
64603
|
-
const tile3dAttributesWorkerUrl = getWorkerURL(Tile3dAttributesWorker, { ...getGlobalLoaderOptions() });
|
|
64604
|
-
const sourceResponse = await fetchFile(tile3dAttributesWorkerUrl);
|
|
64605
|
-
const source = await sourceResponse.text();
|
|
64606
|
-
this.workerSource.tile3dWorkerSource = source;
|
|
64607
|
-
console.log(`Loading workers source completed!`);
|
|
64608
|
-
}
|
|
64609
65115
|
};
|
|
64610
65116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
64611
65117
|
0 && (module.exports = {
|