@loaders.gl/tile-converter 4.0.0-alpha.6 → 4.0.0-alpha.7
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/bin/converter.js +1 -1
- package/dist/3d-tiles-attributes-worker.js +2 -2
- package/dist/3d-tiles-attributes-worker.js.map +3 -3
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +4 -3
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -8
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +2 -15
- package/dist/converter.min.js +75 -76
- package/dist/deps-installer/deps-installer.js +3 -3
- package/dist/dist.min.js +1870 -1581
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +0 -3
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +2 -10
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +4 -4
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js.map +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/geometry-converter.js +25 -17
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +1 -4
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +0 -7
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/lib/utils/geometry-utils.js +15 -0
- package/dist/es5/lib/utils/geometry-utils.js.map +1 -0
- 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 +0 -3
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +2 -8
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +4 -4
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js.map +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/geometry-converter.js +19 -11
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +1 -4
- 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/lib/utils/geometry-utils.js +8 -0
- package/dist/esm/lib/utils/geometry-utils.js.map +1 -0
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.d.ts +10 -2
- package/dist/i3s-attributes-worker.d.ts.map +1 -1
- package/dist/i3s-attributes-worker.js +2 -2
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +4 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +2 -2
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +51 -43
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +1 -4
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +7 -6
- package/dist/lib/utils/geometry-utils.d.ts +9 -0
- package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
- package/dist/lib/utils/geometry-utils.js +18 -0
- package/package.json +15 -16
- package/src/3d-tiles-converter/3d-tiles-converter.ts +4 -3
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +2 -16
- package/src/deps-installer/deps-installer.ts +3 -3
- package/src/i3s-attributes-worker.ts +11 -2
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +13 -14
- package/src/i3s-converter/helpers/geometry-converter.ts +105 -78
- package/src/i3s-converter/helpers/gltf-attributes.ts +1 -4
- package/src/i3s-converter/i3s-converter.ts +8 -7
- package/src/lib/utils/geometry-utils.ts +14 -0
|
@@ -24,6 +24,7 @@ var _gltfAttributes = require("./gltf-attributes");
|
|
|
24
24
|
var _batchIdsExtensions = require("./batch-ids-extensions");
|
|
25
25
|
var _featureAttributes = require("./feature-attributes");
|
|
26
26
|
var _math = require("@loaders.gl/math");
|
|
27
|
+
var _geometryUtils = require("../../lib/utils/geometry-utils");
|
|
27
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -376,21 +377,22 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
376
377
|
var materialUvRegion;
|
|
377
378
|
if (primitive.material) {
|
|
378
379
|
var _outputAttributes, _outputAttributes$mer;
|
|
379
|
-
outputAttributes = attributesMap.get(primitive.material.
|
|
380
|
+
outputAttributes = attributesMap.get(primitive.material.id);
|
|
380
381
|
materialUvRegion = (_outputAttributes = outputAttributes) === null || _outputAttributes === void 0 ? void 0 : (_outputAttributes$mer = _outputAttributes.mergedMaterials.find(function (_ref2) {
|
|
381
382
|
var _primitive$material;
|
|
382
383
|
var originalMaterialId = _ref2.originalMaterialId;
|
|
383
|
-
return originalMaterialId === ((_primitive$material = primitive.material) === null || _primitive$material === void 0 ? void 0 : _primitive$material.
|
|
384
|
+
return originalMaterialId === ((_primitive$material = primitive.material) === null || _primitive$material === void 0 ? void 0 : _primitive$material.id);
|
|
384
385
|
})) === null || _outputAttributes$mer === void 0 ? void 0 : _outputAttributes$mer.uvRegion;
|
|
385
386
|
} else if (attributesMap.has('default')) {
|
|
386
387
|
outputAttributes = attributesMap.get('default');
|
|
387
388
|
}
|
|
388
389
|
(0, _core2.assert)(outputAttributes !== null, 'Primitive - material mapping failed');
|
|
390
|
+
(0, _core2.assert)(primitive.mode === _math.GL.TRIANGLES || primitive.mode === _math.GL.TRIANGLE_STRIP, "Primitive - unsupported mode ".concat(primitive.mode));
|
|
389
391
|
var attributes = primitive.attributes;
|
|
390
392
|
if (!outputAttributes) {
|
|
391
393
|
return "continue";
|
|
392
394
|
}
|
|
393
|
-
var indices =
|
|
395
|
+
var indices = normalizeIndices(primitive);
|
|
394
396
|
outputAttributes.positions = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.positions, transformVertexArray({
|
|
395
397
|
vertices: attributes.POSITION.value,
|
|
396
398
|
cartographicOrigin: cartographicOrigin,
|
|
@@ -427,9 +429,13 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
427
429
|
_iterator3.f();
|
|
428
430
|
}
|
|
429
431
|
}
|
|
430
|
-
function
|
|
432
|
+
function normalizeIndices(primitive) {
|
|
431
433
|
var _primitive$indices;
|
|
432
434
|
var indices = (_primitive$indices = primitive.indices) === null || _primitive$indices === void 0 ? void 0 : _primitive$indices.value;
|
|
435
|
+
if (!indices) {
|
|
436
|
+
var positions = primitive.attributes.POSITION.value;
|
|
437
|
+
return (0, _geometryUtils.generateSyntheticIndices)(positions.length / VALUES_PER_VERTEX);
|
|
438
|
+
}
|
|
433
439
|
if (indices && primitive.mode === _math.GL.TRIANGLE_STRIP) {
|
|
434
440
|
var TypedArrayConstructor = indices.constructor;
|
|
435
441
|
var newIndices = new TypedArrayConstructor((indices.length - 2) * 3);
|
|
@@ -643,12 +649,12 @@ function _mergeAllMaterials() {
|
|
|
643
649
|
break;
|
|
644
650
|
case 15:
|
|
645
651
|
if (newMaterial.texture && mergedIndices.length) {
|
|
646
|
-
newWidth = (_newMaterial$mergedMa = newMaterial.mergedMaterials) === null || _newMaterial$mergedMa === void 0 ? void 0 : _newMaterial$mergedMa.reduce(function (accum,
|
|
647
|
-
var textureSize =
|
|
652
|
+
newWidth = (_newMaterial$mergedMa = newMaterial.mergedMaterials) === null || _newMaterial$mergedMa === void 0 ? void 0 : _newMaterial$mergedMa.reduce(function (accum, _ref5) {
|
|
653
|
+
var textureSize = _ref5.textureSize;
|
|
648
654
|
return accum + ((textureSize === null || textureSize === void 0 ? void 0 : textureSize.width) || 0);
|
|
649
655
|
}, 0);
|
|
650
|
-
newHeight = (_newMaterial$mergedMa2 = newMaterial.mergedMaterials) === null || _newMaterial$mergedMa2 === void 0 ? void 0 : _newMaterial$mergedMa2.reduce(function (accum,
|
|
651
|
-
var textureSize =
|
|
656
|
+
newHeight = (_newMaterial$mergedMa2 = newMaterial.mergedMaterials) === null || _newMaterial$mergedMa2 === void 0 ? void 0 : _newMaterial$mergedMa2.reduce(function (accum, _ref6) {
|
|
657
|
+
var textureSize = _ref6.textureSize;
|
|
652
658
|
return Math.max(accum, (textureSize === null || textureSize === void 0 ? void 0 : textureSize.height) || 0);
|
|
653
659
|
}, 0);
|
|
654
660
|
currentX = -1;
|
|
@@ -781,10 +787,9 @@ function convertMaterial(sourceMaterial) {
|
|
|
781
787
|
textureSetDefinitionId: 0
|
|
782
788
|
};
|
|
783
789
|
}
|
|
784
|
-
|
|
785
|
-
sourceMaterial.uniqueId = uniqueId;
|
|
790
|
+
sourceMaterial.id = Number.isFinite(sourceMaterial.id) ? sourceMaterial.id : (0, _uuid.v4)();
|
|
786
791
|
var mergedMaterials = [{
|
|
787
|
-
originalMaterialId:
|
|
792
|
+
originalMaterialId: sourceMaterial.id
|
|
788
793
|
}];
|
|
789
794
|
if (!texture) {
|
|
790
795
|
var _sourceMaterial$pbrMe4;
|
|
@@ -892,21 +897,24 @@ function extractSharedResourcesMaterialInfo(baseColorFactor) {
|
|
|
892
897
|
};
|
|
893
898
|
}
|
|
894
899
|
function extractSharedResourcesTextureInfo(texture, nodeId) {
|
|
895
|
-
var _texture$source, _texture$source2, _texture$source3;
|
|
900
|
+
var _texture$source, _texture$source2, _texture$source3, _texture$source4;
|
|
896
901
|
return {
|
|
897
902
|
encoding: texture !== null && texture !== void 0 && (_texture$source = texture.source) !== null && _texture$source !== void 0 && _texture$source.mimeType ? [texture.source.mimeType] : undefined,
|
|
898
903
|
images: [{
|
|
899
904
|
id: generateImageId(texture, nodeId),
|
|
900
905
|
size: (_texture$source2 = texture.source) === null || _texture$source2 === void 0 ? void 0 : _texture$source2.image.width,
|
|
901
|
-
length:
|
|
906
|
+
length: (_texture$source3 = texture.source) !== null && _texture$source3 !== void 0 && _texture$source3.image.data.length ? [(_texture$source4 = texture.source) === null || _texture$source4 === void 0 ? void 0 : _texture$source4.image.data.length] : undefined
|
|
902
907
|
}]
|
|
903
908
|
};
|
|
904
909
|
}
|
|
905
910
|
function generateImageId(texture, nodeId) {
|
|
906
|
-
var _texture$
|
|
907
|
-
var
|
|
908
|
-
width =
|
|
909
|
-
height =
|
|
911
|
+
var _texture$source5;
|
|
912
|
+
var _ref4 = ((_texture$source5 = texture.source) === null || _texture$source5 === void 0 ? void 0 : _texture$source5.image) || {},
|
|
913
|
+
width = _ref4.width,
|
|
914
|
+
height = _ref4.height;
|
|
915
|
+
if (!width || !height) {
|
|
916
|
+
return '';
|
|
917
|
+
}
|
|
910
918
|
var levelCountOfTexture = 1;
|
|
911
919
|
var indexOfLevel = 0;
|
|
912
920
|
var indexOfTextureInStore = nodeId + 1;
|