@loaders.gl/tile-converter 3.4.0-alpha.2 → 3.4.0-alpha.4
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 +3 -3
- package/dist/converter.min.js +90 -2875
- package/dist/dist.min.js +1823 -19725
- package/dist/es5/3d-tiles-attributes-worker.js +1 -2
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +264 -287
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +89 -113
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +0 -2
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/converter-cli.js +67 -81
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +64 -69
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -2
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +0 -8
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +0 -5
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +14 -16
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +1 -11
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +3 -10
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +427 -457
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +0 -2
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +3 -13
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +293 -318
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +279 -319
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +964 -1030
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +28 -30
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +15 -18
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +198 -218
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +118 -128
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +0 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +81 -85
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +84 -92
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +7 -10
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +7 -9
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/workers/i3s-attributes-worker.js +10 -12
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -3
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +1 -15
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +0 -12
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +0 -3
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/converter-cli.js +0 -11
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -4
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -3
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +0 -8
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +0 -5
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +0 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +0 -11
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +0 -7
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +30 -56
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +0 -3
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js +3 -13
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js +0 -14
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +0 -18
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +4 -42
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/controllers/index-controller.js +0 -2
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/i3s-server/routes/index.js +0 -1
- package/dist/esm/i3s-server/routes/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +1 -17
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +0 -7
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js +0 -2
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js.map +1 -1
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +0 -2
- package/dist/esm/lib/utils/write-queue.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -3
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/workers/i3s-attributes-worker.js.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/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +44 -6
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-debug.js +10 -4
- package/dist/i3s-converter/helpers/node-pages.js +1 -1
- package/dist/i3s-converter/types.d.ts +1 -0
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/i3s-converter/helpers/geometry-converter.ts +59 -14
- package/src/i3s-converter/helpers/node-debug.ts +11 -5
- package/src/i3s-converter/types.ts +10 -0
|
@@ -23,13 +23,14 @@ var _coordinateConverter = require("./coordinate-converter");
|
|
|
23
23
|
var _gltfAttributes = require("./gltf-attributes");
|
|
24
24
|
var _batchIdsExtensions = require("./batch-ids-extensions");
|
|
25
25
|
var _featureAttributes = require("./feature-attributes");
|
|
26
|
+
var _math = require("@loaders.gl/math");
|
|
26
27
|
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); }
|
|
27
28
|
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; }
|
|
28
29
|
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; }
|
|
29
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
31
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
31
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
32
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
33
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
33
34
|
var DEFAULT_ROUGHNESS_FACTOR = 1;
|
|
34
35
|
var DEFAULT_METALLIC_FACTOR = 1;
|
|
35
36
|
var VALUES_PER_VERTEX = 3;
|
|
@@ -43,7 +44,6 @@ var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ['CUSTOM_ATTRIBUTE_2', '_BATCHID', 'BA
|
|
|
43
44
|
var EXT_FEATURE_METADATA = 'EXT_feature_metadata';
|
|
44
45
|
var EXT_MESH_FEATURES = 'EXT_mesh_features';
|
|
45
46
|
var scratchVector = new _core.Vector3();
|
|
46
|
-
|
|
47
47
|
function convertB3dmToI3sGeometry(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10) {
|
|
48
48
|
return _convertB3dmToI3sGeometry.apply(this, arguments);
|
|
49
49
|
}
|
|
@@ -52,95 +52,92 @@ function _convertB3dmToI3sGeometry() {
|
|
|
52
52
|
var _tileContent$gltf4;
|
|
53
53
|
var useCartesianPositions, materialAndTextureList, dataForAttributesConversion, convertedAttributesMap, result, _iterator6, _step6, materialAndTexture, originarMaterialId, convertedAttributes, material, texture, nodeId;
|
|
54
54
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
55
|
-
while (1) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if ((_step6 = _iterator6.n()).done) {
|
|
78
|
-
_context.next = 32;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
materialAndTexture = _step6.value;
|
|
82
|
-
originarMaterialId = materialAndTexture.mergedMaterials[0].originalMaterialId;
|
|
83
|
-
if (convertedAttributesMap.has(originarMaterialId)) {
|
|
84
|
-
_context.next = 18;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
return _context.abrupt("continue", 30);
|
|
88
|
-
case 18:
|
|
89
|
-
convertedAttributes = convertedAttributesMap.get(originarMaterialId);
|
|
90
|
-
if (convertedAttributes) {
|
|
91
|
-
_context.next = 21;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
return _context.abrupt("continue", 30);
|
|
95
|
-
case 21:
|
|
96
|
-
material = materialAndTexture.material, texture = materialAndTexture.texture;
|
|
97
|
-
_context.next = 24;
|
|
98
|
-
return addNodeToNodePage();
|
|
99
|
-
case 24:
|
|
100
|
-
nodeId = _context.sent;
|
|
101
|
-
_context.t0 = result;
|
|
102
|
-
_context.next = 28;
|
|
103
|
-
return _makeNodeResources({
|
|
104
|
-
convertedAttributes: convertedAttributes,
|
|
105
|
-
material: material,
|
|
106
|
-
texture: texture,
|
|
107
|
-
tileContent: tileContent,
|
|
108
|
-
nodeId: nodeId,
|
|
109
|
-
featuresHashArray: featuresHashArray,
|
|
110
|
-
propertyTable: propertyTable,
|
|
111
|
-
attributeStorageInfo: attributeStorageInfo,
|
|
112
|
-
draco: draco,
|
|
113
|
-
workerSource: workerSource
|
|
114
|
-
});
|
|
115
|
-
case 28:
|
|
116
|
-
_context.t1 = _context.sent;
|
|
117
|
-
_context.t0.push.call(_context.t0, _context.t1);
|
|
118
|
-
case 30:
|
|
119
|
-
_context.next = 13;
|
|
55
|
+
while (1) switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
useCartesianPositions = generateBoundingVolumes;
|
|
58
|
+
_context.next = 3;
|
|
59
|
+
return convertMaterials((_tileContent$gltf4 = tileContent.gltf) === null || _tileContent$gltf4 === void 0 ? void 0 : _tileContent$gltf4.materials, shouldMergeMaterials);
|
|
60
|
+
case 3:
|
|
61
|
+
materialAndTextureList = _context.sent;
|
|
62
|
+
dataForAttributesConversion = (0, _gltfAttributes.prepareDataForAttributesConversion)(tileContent);
|
|
63
|
+
_context.next = 7;
|
|
64
|
+
return convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
|
|
65
|
+
case 7:
|
|
66
|
+
convertedAttributesMap = _context.sent;
|
|
67
|
+
if (generateBoundingVolumes) {
|
|
68
|
+
_generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
|
|
69
|
+
}
|
|
70
|
+
result = [];
|
|
71
|
+
_iterator6 = _createForOfIteratorHelper(materialAndTextureList);
|
|
72
|
+
_context.prev = 11;
|
|
73
|
+
_iterator6.s();
|
|
74
|
+
case 13:
|
|
75
|
+
if ((_step6 = _iterator6.n()).done) {
|
|
76
|
+
_context.next = 32;
|
|
120
77
|
break;
|
|
121
|
-
|
|
122
|
-
|
|
78
|
+
}
|
|
79
|
+
materialAndTexture = _step6.value;
|
|
80
|
+
originarMaterialId = materialAndTexture.mergedMaterials[0].originalMaterialId;
|
|
81
|
+
if (convertedAttributesMap.has(originarMaterialId)) {
|
|
82
|
+
_context.next = 18;
|
|
123
83
|
break;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_context.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
84
|
+
}
|
|
85
|
+
return _context.abrupt("continue", 30);
|
|
86
|
+
case 18:
|
|
87
|
+
convertedAttributes = convertedAttributesMap.get(originarMaterialId);
|
|
88
|
+
if (convertedAttributes) {
|
|
89
|
+
_context.next = 21;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
return _context.abrupt("continue", 30);
|
|
93
|
+
case 21:
|
|
94
|
+
material = materialAndTexture.material, texture = materialAndTexture.texture;
|
|
95
|
+
_context.next = 24;
|
|
96
|
+
return addNodeToNodePage();
|
|
97
|
+
case 24:
|
|
98
|
+
nodeId = _context.sent;
|
|
99
|
+
_context.t0 = result;
|
|
100
|
+
_context.next = 28;
|
|
101
|
+
return _makeNodeResources({
|
|
102
|
+
convertedAttributes: convertedAttributes,
|
|
103
|
+
material: material,
|
|
104
|
+
texture: texture,
|
|
105
|
+
tileContent: tileContent,
|
|
106
|
+
nodeId: nodeId,
|
|
107
|
+
featuresHashArray: featuresHashArray,
|
|
108
|
+
propertyTable: propertyTable,
|
|
109
|
+
attributeStorageInfo: attributeStorageInfo,
|
|
110
|
+
draco: draco,
|
|
111
|
+
workerSource: workerSource
|
|
112
|
+
});
|
|
113
|
+
case 28:
|
|
114
|
+
_context.t1 = _context.sent;
|
|
115
|
+
_context.t0.push.call(_context.t0, _context.t1);
|
|
116
|
+
case 30:
|
|
117
|
+
_context.next = 13;
|
|
118
|
+
break;
|
|
119
|
+
case 32:
|
|
120
|
+
_context.next = 37;
|
|
121
|
+
break;
|
|
122
|
+
case 34:
|
|
123
|
+
_context.prev = 34;
|
|
124
|
+
_context.t2 = _context["catch"](11);
|
|
125
|
+
_iterator6.e(_context.t2);
|
|
126
|
+
case 37:
|
|
127
|
+
_context.prev = 37;
|
|
128
|
+
_iterator6.f();
|
|
129
|
+
return _context.finish(37);
|
|
130
|
+
case 40:
|
|
131
|
+
if (result.length) {
|
|
132
|
+
_context.next = 42;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
return _context.abrupt("return", null);
|
|
136
|
+
case 42:
|
|
137
|
+
return _context.abrupt("return", result);
|
|
138
|
+
case 43:
|
|
139
|
+
case "end":
|
|
140
|
+
return _context.stop();
|
|
144
141
|
}
|
|
145
142
|
}, _callee, null, [[11, 34, 37, 40]]);
|
|
146
143
|
}));
|
|
@@ -169,7 +166,6 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
169
166
|
_iterator.f();
|
|
170
167
|
}
|
|
171
168
|
}
|
|
172
|
-
|
|
173
169
|
function _makeNodeResources(_x11) {
|
|
174
170
|
return _makeNodeResources2.apply(this, arguments);
|
|
175
171
|
}
|
|
@@ -178,50 +174,48 @@ function _makeNodeResources2() {
|
|
|
178
174
|
var _tileContent$gltf5;
|
|
179
175
|
var convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, workerSource, boundingVolumes, vertexCount, _generateAttributes, faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount, header, typedFeatureIds, fileBuffer, compressedGeometry, attributes;
|
|
180
176
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
181
|
-
while (1) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return _context2.stop();
|
|
224
|
-
}
|
|
177
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
178
|
+
case 0:
|
|
179
|
+
convertedAttributes = _ref.convertedAttributes, material = _ref.material, texture = _ref.texture, tileContent = _ref.tileContent, nodeId = _ref.nodeId, featuresHashArray = _ref.featuresHashArray, propertyTable = _ref.propertyTable, attributeStorageInfo = _ref.attributeStorageInfo, draco = _ref.draco, workerSource = _ref.workerSource;
|
|
180
|
+
boundingVolumes = convertedAttributes.boundingVolumes;
|
|
181
|
+
vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX;
|
|
182
|
+
_generateAttributes = (0, _geometryAttributes.generateAttributes)(convertedAttributes), faceRange = _generateAttributes.faceRange, featureIds = _generateAttributes.featureIds, positions = _generateAttributes.positions, normals = _generateAttributes.normals, colors = _generateAttributes.colors, uvRegions = _generateAttributes.uvRegions, texCoords = _generateAttributes.texCoords, featureCount = _generateAttributes.featureCount;
|
|
183
|
+
if (tileContent.batchTableJson) {
|
|
184
|
+
makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, tileContent.batchTableJson);
|
|
185
|
+
}
|
|
186
|
+
header = new Uint32Array(2);
|
|
187
|
+
typedFeatureIds = generateBigUint64Array(featureIds);
|
|
188
|
+
header.set([vertexCount, featureCount], 0);
|
|
189
|
+
fileBuffer = new Uint8Array((0, _loaderUtils.concatenateArrayBuffers)(header.buffer, positions.buffer, normals.buffer, texture ? texCoords.buffer : new ArrayBuffer(0), colors.buffer, uvRegions, typedFeatureIds.buffer, faceRange.buffer));
|
|
190
|
+
compressedGeometry = draco ? generateCompressedGeometry(vertexCount, convertedAttributes, {
|
|
191
|
+
positions: positions,
|
|
192
|
+
normals: normals,
|
|
193
|
+
texCoords: texture ? texCoords : new Float32Array(0),
|
|
194
|
+
colors: colors,
|
|
195
|
+
uvRegions: uvRegions,
|
|
196
|
+
featureIds: featureIds,
|
|
197
|
+
faceRange: faceRange
|
|
198
|
+
}, workerSource.draco) : null;
|
|
199
|
+
attributes = [];
|
|
200
|
+
if (attributeStorageInfo && propertyTable) {
|
|
201
|
+
attributes = convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo);
|
|
202
|
+
}
|
|
203
|
+
return _context2.abrupt("return", {
|
|
204
|
+
nodeId: nodeId,
|
|
205
|
+
geometry: fileBuffer,
|
|
206
|
+
compressedGeometry: compressedGeometry,
|
|
207
|
+
texture: texture,
|
|
208
|
+
hasUvRegions: Boolean(uvRegions.length),
|
|
209
|
+
sharedResources: getSharedResources(((_tileContent$gltf5 = tileContent.gltf) === null || _tileContent$gltf5 === void 0 ? void 0 : _tileContent$gltf5.materials) || [], nodeId),
|
|
210
|
+
meshMaterial: material,
|
|
211
|
+
vertexCount: vertexCount,
|
|
212
|
+
attributes: attributes,
|
|
213
|
+
featureCount: featureCount,
|
|
214
|
+
boundingVolumes: boundingVolumes
|
|
215
|
+
});
|
|
216
|
+
case 13:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context2.stop();
|
|
225
219
|
}
|
|
226
220
|
}, _callee2);
|
|
227
221
|
}));
|
|
@@ -234,93 +228,91 @@ function _convertAttributes() {
|
|
|
234
228
|
_convertAttributes = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(attributesData, materialAndTextureList, useCartesianPositions) {
|
|
235
229
|
var nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, _iterator7, _step7, materialAndTexture, attributes, _iterator9, _step9, mergedMaterial, _iterator8, _step8, attrKey, _attributes;
|
|
236
230
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
237
|
-
while (1) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
attributesMap.set(mergedMaterial.originalMaterialId, attributes);
|
|
262
|
-
}
|
|
263
|
-
} catch (err) {
|
|
264
|
-
_iterator9.e(err);
|
|
265
|
-
} finally {
|
|
266
|
-
_iterator9.f();
|
|
231
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
232
|
+
case 0:
|
|
233
|
+
nodes = attributesData.nodes, images = attributesData.images, cartographicOrigin = attributesData.cartographicOrigin, cartesianModelMatrix = attributesData.cartesianModelMatrix;
|
|
234
|
+
attributesMap = new Map();
|
|
235
|
+
_iterator7 = _createForOfIteratorHelper(materialAndTextureList);
|
|
236
|
+
try {
|
|
237
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
238
|
+
materialAndTexture = _step7.value;
|
|
239
|
+
attributes = {
|
|
240
|
+
positions: new Float32Array(0),
|
|
241
|
+
normals: new Float32Array(0),
|
|
242
|
+
texCoords: new Float32Array(0),
|
|
243
|
+
colors: new Uint8Array(0),
|
|
244
|
+
uvRegions: new Uint16Array(0),
|
|
245
|
+
featureIndicesGroups: [],
|
|
246
|
+
featureIndices: [],
|
|
247
|
+
boundingVolumes: null,
|
|
248
|
+
mergedMaterials: materialAndTexture.mergedMaterials
|
|
249
|
+
};
|
|
250
|
+
_iterator9 = _createForOfIteratorHelper(materialAndTexture.mergedMaterials);
|
|
251
|
+
try {
|
|
252
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
253
|
+
mergedMaterial = _step9.value;
|
|
254
|
+
attributesMap.set(mergedMaterial.originalMaterialId, attributes);
|
|
267
255
|
}
|
|
256
|
+
} catch (err) {
|
|
257
|
+
_iterator9.e(err);
|
|
258
|
+
} finally {
|
|
259
|
+
_iterator9.f();
|
|
268
260
|
}
|
|
269
|
-
} catch (err) {
|
|
270
|
-
_iterator7.e(err);
|
|
271
|
-
} finally {
|
|
272
|
-
_iterator7.f();
|
|
273
|
-
}
|
|
274
|
-
convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
275
|
-
_iterator8 = _createForOfIteratorHelper(attributesMap.keys());
|
|
276
|
-
_context3.prev = 6;
|
|
277
|
-
_iterator8.s();
|
|
278
|
-
case 8:
|
|
279
|
-
if ((_step8 = _iterator8.n()).done) {
|
|
280
|
-
_context3.next = 19;
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
attrKey = _step8.value;
|
|
284
|
-
_attributes = attributesMap.get(attrKey);
|
|
285
|
-
if (_attributes) {
|
|
286
|
-
_context3.next = 13;
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
return _context3.abrupt("continue", 17);
|
|
290
|
-
case 13:
|
|
291
|
-
if (!(_attributes.positions.length === 0)) {
|
|
292
|
-
_context3.next = 16;
|
|
293
|
-
break;
|
|
294
261
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
262
|
+
} catch (err) {
|
|
263
|
+
_iterator7.e(err);
|
|
264
|
+
} finally {
|
|
265
|
+
_iterator7.f();
|
|
266
|
+
}
|
|
267
|
+
convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
268
|
+
_iterator8 = _createForOfIteratorHelper(attributesMap.keys());
|
|
269
|
+
_context3.prev = 6;
|
|
270
|
+
_iterator8.s();
|
|
271
|
+
case 8:
|
|
272
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
273
|
+
_context3.next = 19;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
attrKey = _step8.value;
|
|
277
|
+
_attributes = attributesMap.get(attrKey);
|
|
278
|
+
if (_attributes) {
|
|
279
|
+
_context3.next = 13;
|
|
306
280
|
break;
|
|
307
|
-
|
|
308
|
-
|
|
281
|
+
}
|
|
282
|
+
return _context3.abrupt("continue", 17);
|
|
283
|
+
case 13:
|
|
284
|
+
if (!(_attributes.positions.length === 0)) {
|
|
285
|
+
_context3.next = 16;
|
|
309
286
|
break;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
287
|
+
}
|
|
288
|
+
attributesMap.delete(attrKey);
|
|
289
|
+
return _context3.abrupt("continue", 17);
|
|
290
|
+
case 16:
|
|
291
|
+
if (_attributes.featureIndicesGroups) {
|
|
292
|
+
_attributes.featureIndices = _attributes.featureIndicesGroups.reduce(function (acc, value) {
|
|
293
|
+
return acc.concat(value);
|
|
294
|
+
});
|
|
295
|
+
delete _attributes.featureIndicesGroups;
|
|
296
|
+
}
|
|
297
|
+
case 17:
|
|
298
|
+
_context3.next = 8;
|
|
299
|
+
break;
|
|
300
|
+
case 19:
|
|
301
|
+
_context3.next = 24;
|
|
302
|
+
break;
|
|
303
|
+
case 21:
|
|
304
|
+
_context3.prev = 21;
|
|
305
|
+
_context3.t0 = _context3["catch"](6);
|
|
306
|
+
_iterator8.e(_context3.t0);
|
|
307
|
+
case 24:
|
|
308
|
+
_context3.prev = 24;
|
|
309
|
+
_iterator8.f();
|
|
310
|
+
return _context3.finish(24);
|
|
311
|
+
case 27:
|
|
312
|
+
return _context3.abrupt("return", attributesMap);
|
|
313
|
+
case 28:
|
|
314
|
+
case "end":
|
|
315
|
+
return _context3.stop();
|
|
324
316
|
}
|
|
325
317
|
}, _callee3, null, [[6, 21, 24, 27]]);
|
|
326
318
|
}));
|
|
@@ -343,7 +335,6 @@ function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, a
|
|
|
343
335
|
}
|
|
344
336
|
}
|
|
345
337
|
}
|
|
346
|
-
|
|
347
338
|
function getCompositeTransformationMatrix(node, matrix) {
|
|
348
339
|
var transformationMatrix = matrix;
|
|
349
340
|
var nodeMatrix = node.matrix,
|
|
@@ -364,7 +355,6 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
364
355
|
}
|
|
365
356
|
return transformationMatrix;
|
|
366
357
|
}
|
|
367
|
-
|
|
368
358
|
function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
|
|
369
359
|
var matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
370
360
|
var transformationMatrix = getCompositeTransformationMatrix(node, matrix);
|
|
@@ -374,7 +364,6 @@ function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
374
364
|
}
|
|
375
365
|
convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
376
366
|
}
|
|
377
|
-
|
|
378
367
|
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap) {
|
|
379
368
|
var useCartesianPositions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
380
369
|
var matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
@@ -382,10 +371,9 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
382
371
|
_step3;
|
|
383
372
|
try {
|
|
384
373
|
var _loop = function _loop() {
|
|
385
|
-
var _primitive$indices, _primitive$indices2, _primitive$indices3, _primitive$indices4, _primitive$indices6;
|
|
386
374
|
var primitive = _step3.value;
|
|
387
375
|
var outputAttributes = null;
|
|
388
|
-
var materialUvRegion
|
|
376
|
+
var materialUvRegion;
|
|
389
377
|
if (primitive.material) {
|
|
390
378
|
var _outputAttributes, _outputAttributes$mer;
|
|
391
379
|
outputAttributes = attributesMap.get(primitive.material.uniqueId);
|
|
@@ -402,12 +390,13 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
402
390
|
if (!outputAttributes) {
|
|
403
391
|
return "continue";
|
|
404
392
|
}
|
|
393
|
+
var indices = getIndices(primitive);
|
|
405
394
|
outputAttributes.positions = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.positions, transformVertexArray({
|
|
406
395
|
vertices: attributes.POSITION.value,
|
|
407
396
|
cartographicOrigin: cartographicOrigin,
|
|
408
397
|
cartesianModelMatrix: cartesianModelMatrix,
|
|
409
398
|
nodeMatrix: matrix,
|
|
410
|
-
indices:
|
|
399
|
+
indices: indices,
|
|
411
400
|
attributeSpecificTransformation: transformVertexPositions,
|
|
412
401
|
useCartesianPositions: useCartesianPositions
|
|
413
402
|
}));
|
|
@@ -416,18 +405,17 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
416
405
|
cartographicOrigin: cartographicOrigin,
|
|
417
406
|
cartesianModelMatrix: cartesianModelMatrix,
|
|
418
407
|
nodeMatrix: matrix,
|
|
419
|
-
indices:
|
|
408
|
+
indices: indices,
|
|
420
409
|
attributeSpecificTransformation: transformVertexNormals,
|
|
421
410
|
useCartesianPositions: false
|
|
422
411
|
}));
|
|
423
|
-
outputAttributes.texCoords = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value,
|
|
424
|
-
outputAttributes.colors = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.colors, flattenColors(attributes.COLOR_0,
|
|
412
|
+
outputAttributes.texCoords = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, indices));
|
|
413
|
+
outputAttributes.colors = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.colors, flattenColors(attributes.COLOR_0, indices));
|
|
425
414
|
if (materialUvRegion) {
|
|
426
|
-
|
|
427
|
-
outputAttributes.uvRegions = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.uvRegions, createUvRegion(materialUvRegion, (_primitive$indices5 = primitive.indices) === null || _primitive$indices5 === void 0 ? void 0 : _primitive$indices5.value));
|
|
415
|
+
outputAttributes.uvRegions = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.uvRegions, createUvRegion(materialUvRegion, indices));
|
|
428
416
|
}
|
|
429
417
|
outputAttributes.featureIndicesGroups = outputAttributes.featureIndicesGroups || [];
|
|
430
|
-
outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images),
|
|
418
|
+
outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images), indices));
|
|
431
419
|
};
|
|
432
420
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
433
421
|
var _ret = _loop();
|
|
@@ -439,7 +427,28 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
439
427
|
_iterator3.f();
|
|
440
428
|
}
|
|
441
429
|
}
|
|
442
|
-
|
|
430
|
+
function getIndices(primitive) {
|
|
431
|
+
var _primitive$indices;
|
|
432
|
+
var indices = (_primitive$indices = primitive.indices) === null || _primitive$indices === void 0 ? void 0 : _primitive$indices.value;
|
|
433
|
+
if (indices && primitive.mode === _math.GL.TRIANGLE_STRIP) {
|
|
434
|
+
var TypedArrayConstructor = indices.constructor;
|
|
435
|
+
var newIndices = new TypedArrayConstructor((indices.length - 2) * 3);
|
|
436
|
+
var triangleIndex = 0;
|
|
437
|
+
var currentTriangle = indices.slice(0, 3);
|
|
438
|
+
newIndices.set(currentTriangle, 0);
|
|
439
|
+
for (var i = 1; i + 2 < indices.length; i++) {
|
|
440
|
+
triangleIndex += 3;
|
|
441
|
+
currentTriangle = indices.slice(i, i + 3);
|
|
442
|
+
if (i % 2 === 0) {
|
|
443
|
+
newIndices.set(currentTriangle, triangleIndex);
|
|
444
|
+
} else {
|
|
445
|
+
newIndices.set(currentTriangle.reverse(), triangleIndex);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
indices = newIndices;
|
|
449
|
+
}
|
|
450
|
+
return indices;
|
|
451
|
+
}
|
|
443
452
|
function transformVertexArray(args) {
|
|
444
453
|
var vertices = args.vertices,
|
|
445
454
|
indices = args.indices,
|
|
@@ -459,7 +468,6 @@ function transformVertexArray(args) {
|
|
|
459
468
|
}
|
|
460
469
|
return newVertices;
|
|
461
470
|
}
|
|
462
|
-
|
|
463
471
|
function transformVertexPositions(vertexVector, calleeArgs) {
|
|
464
472
|
var cartesianModelMatrix = calleeArgs.cartesianModelMatrix,
|
|
465
473
|
cartographicOrigin = calleeArgs.cartographicOrigin,
|
|
@@ -476,7 +484,6 @@ function transformVertexPositions(vertexVector, calleeArgs) {
|
|
|
476
484
|
vertexVector = vertexVector.subtract(cartographicOrigin);
|
|
477
485
|
return vertexVector;
|
|
478
486
|
}
|
|
479
|
-
|
|
480
487
|
function transformVertexNormals(vertexVector, calleeArgs) {
|
|
481
488
|
var cartesianModelMatrix = calleeArgs.cartesianModelMatrix,
|
|
482
489
|
nodeMatrix = calleeArgs.nodeMatrix;
|
|
@@ -486,7 +493,6 @@ function transformVertexNormals(vertexVector, calleeArgs) {
|
|
|
486
493
|
vertexVector = vertexVector.transformAsVector(cartesianModelMatrix);
|
|
487
494
|
return vertexVector;
|
|
488
495
|
}
|
|
489
|
-
|
|
490
496
|
function flattenTexCoords(texCoords, indices) {
|
|
491
497
|
var newTexCoords = new Float32Array(indices.length * VALUES_PER_TEX_COORD);
|
|
492
498
|
if (!texCoords) {
|
|
@@ -501,7 +507,6 @@ function flattenTexCoords(texCoords, indices) {
|
|
|
501
507
|
}
|
|
502
508
|
return newTexCoords;
|
|
503
509
|
}
|
|
504
|
-
|
|
505
510
|
function flattenColors(colorsAttribute, indices) {
|
|
506
511
|
var components = (colorsAttribute === null || colorsAttribute === void 0 ? void 0 : colorsAttribute.components) || VALUES_PER_COLOR_ELEMENT;
|
|
507
512
|
var newColors = new Uint8Array(indices.length * components);
|
|
@@ -521,7 +526,6 @@ function flattenColors(colorsAttribute, indices) {
|
|
|
521
526
|
}
|
|
522
527
|
return newColors;
|
|
523
528
|
}
|
|
524
|
-
|
|
525
529
|
function createUvRegion(materialUvRegion, indices) {
|
|
526
530
|
var result = new Uint16Array(indices.length * 4);
|
|
527
531
|
for (var i = 0; i < result.length; i += 4) {
|
|
@@ -529,7 +533,6 @@ function createUvRegion(materialUvRegion, indices) {
|
|
|
529
533
|
}
|
|
530
534
|
return result;
|
|
531
535
|
}
|
|
532
|
-
|
|
533
536
|
function flattenBatchIds(batchedIds, indices) {
|
|
534
537
|
if (!batchedIds.length || !indices.length) {
|
|
535
538
|
return [];
|
|
@@ -541,7 +544,6 @@ function flattenBatchIds(batchedIds, indices) {
|
|
|
541
544
|
}
|
|
542
545
|
return newBatchIds;
|
|
543
546
|
}
|
|
544
|
-
|
|
545
547
|
function getBatchIds(attributes, primitive, images) {
|
|
546
548
|
var batchIds = (0, _batchIdsExtensions.handleBatchIdsExtensions)(attributes, primitive, images);
|
|
547
549
|
if (batchIds.length) {
|
|
@@ -555,7 +557,6 @@ function getBatchIds(attributes, primitive, images) {
|
|
|
555
557
|
}
|
|
556
558
|
return [];
|
|
557
559
|
}
|
|
558
|
-
|
|
559
560
|
function convertMaterials() {
|
|
560
561
|
return _convertMaterials.apply(this, arguments);
|
|
561
562
|
}
|
|
@@ -569,37 +570,35 @@ function _convertMaterials() {
|
|
|
569
570
|
sourceMaterial,
|
|
570
571
|
_args4 = arguments;
|
|
571
572
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
572
|
-
while (1) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
materials.push(convertMaterial(sourceMaterial));
|
|
583
|
-
}
|
|
584
|
-
} catch (err) {
|
|
585
|
-
_iterator10.e(err);
|
|
586
|
-
} finally {
|
|
587
|
-
_iterator10.f();
|
|
573
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
574
|
+
case 0:
|
|
575
|
+
sourceMaterials = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
|
|
576
|
+
shouldMergeMaterials = _args4.length > 1 ? _args4[1] : undefined;
|
|
577
|
+
materials = [];
|
|
578
|
+
_iterator10 = _createForOfIteratorHelper(sourceMaterials);
|
|
579
|
+
try {
|
|
580
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
581
|
+
sourceMaterial = _step10.value;
|
|
582
|
+
materials.push(convertMaterial(sourceMaterial));
|
|
588
583
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
584
|
+
} catch (err) {
|
|
585
|
+
_iterator10.e(err);
|
|
586
|
+
} finally {
|
|
587
|
+
_iterator10.f();
|
|
588
|
+
}
|
|
589
|
+
if (!shouldMergeMaterials) {
|
|
590
|
+
_context4.next = 9;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
_context4.next = 8;
|
|
594
|
+
return mergeAllMaterials(materials);
|
|
595
|
+
case 8:
|
|
596
|
+
materials = _context4.sent;
|
|
597
|
+
case 9:
|
|
598
|
+
return _context4.abrupt("return", materials);
|
|
599
|
+
case 10:
|
|
600
|
+
case "end":
|
|
601
|
+
return _context4.stop();
|
|
603
602
|
}
|
|
604
603
|
}, _callee4);
|
|
605
604
|
}));
|
|
@@ -612,94 +611,92 @@ function _mergeAllMaterials() {
|
|
|
612
611
|
_mergeAllMaterials = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(materials) {
|
|
613
612
|
var result, newMaterial, mergedIndices, i, material, _newMaterial$mergedMa, _newMaterial$mergedMa2, newWidth, newHeight, currentX, _iterator11, _step11, aTextureMetadata, newX, _iterator12, _step12, index;
|
|
614
613
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
615
|
-
while (1) {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
_context5.next = 21;
|
|
622
|
-
break;
|
|
623
|
-
}
|
|
624
|
-
newMaterial = materials.splice(0, 1)[0];
|
|
625
|
-
mergedIndices = [];
|
|
626
|
-
i = 0;
|
|
627
|
-
case 5:
|
|
628
|
-
if (!(i < materials.length)) {
|
|
629
|
-
_context5.next = 15;
|
|
630
|
-
break;
|
|
631
|
-
}
|
|
632
|
-
material = materials[i];
|
|
633
|
-
if (!(newMaterial.texture && material.texture || !newMaterial.texture && !material.texture)) {
|
|
634
|
-
_context5.next = 12;
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
637
|
-
_context5.next = 10;
|
|
638
|
-
return mergeMaterials(newMaterial, material);
|
|
639
|
-
case 10:
|
|
640
|
-
newMaterial = _context5.sent;
|
|
641
|
-
mergedIndices.push(i);
|
|
642
|
-
case 12:
|
|
643
|
-
i++;
|
|
644
|
-
_context5.next = 5;
|
|
614
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
615
|
+
case 0:
|
|
616
|
+
result = [];
|
|
617
|
+
case 1:
|
|
618
|
+
if (!(materials.length > 0)) {
|
|
619
|
+
_context5.next = 21;
|
|
645
620
|
break;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
|
|
621
|
+
}
|
|
622
|
+
newMaterial = materials.splice(0, 1)[0];
|
|
623
|
+
mergedIndices = [];
|
|
624
|
+
i = 0;
|
|
625
|
+
case 5:
|
|
626
|
+
if (!(i < materials.length)) {
|
|
627
|
+
_context5.next = 15;
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
material = materials[i];
|
|
631
|
+
if (!(newMaterial.texture && material.texture || !newMaterial.texture && !material.texture)) {
|
|
632
|
+
_context5.next = 12;
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
_context5.next = 10;
|
|
636
|
+
return mergeMaterials(newMaterial, material);
|
|
637
|
+
case 10:
|
|
638
|
+
newMaterial = _context5.sent;
|
|
639
|
+
mergedIndices.push(i);
|
|
640
|
+
case 12:
|
|
641
|
+
i++;
|
|
642
|
+
_context5.next = 5;
|
|
643
|
+
break;
|
|
644
|
+
case 15:
|
|
645
|
+
if (newMaterial.texture && mergedIndices.length) {
|
|
646
|
+
newWidth = (_newMaterial$mergedMa = newMaterial.mergedMaterials) === null || _newMaterial$mergedMa === void 0 ? void 0 : _newMaterial$mergedMa.reduce(function (accum, _ref4) {
|
|
647
|
+
var textureSize = _ref4.textureSize;
|
|
648
|
+
return accum + ((textureSize === null || textureSize === void 0 ? void 0 : textureSize.width) || 0);
|
|
649
|
+
}, 0);
|
|
650
|
+
newHeight = (_newMaterial$mergedMa2 = newMaterial.mergedMaterials) === null || _newMaterial$mergedMa2 === void 0 ? void 0 : _newMaterial$mergedMa2.reduce(function (accum, _ref5) {
|
|
651
|
+
var textureSize = _ref5.textureSize;
|
|
652
|
+
return Math.max(accum, (textureSize === null || textureSize === void 0 ? void 0 : textureSize.height) || 0);
|
|
653
|
+
}, 0);
|
|
654
|
+
currentX = -1;
|
|
655
|
+
_iterator11 = _createForOfIteratorHelper(newMaterial.mergedMaterials);
|
|
676
656
|
try {
|
|
677
|
-
for (
|
|
678
|
-
|
|
679
|
-
|
|
657
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
658
|
+
aTextureMetadata = _step11.value;
|
|
659
|
+
if (aTextureMetadata.textureSize) {
|
|
660
|
+
newX = currentX + 1 + aTextureMetadata.textureSize.width / newWidth * Math.pow(2, Uint16Array.BYTES_PER_ELEMENT * 8) - 1;
|
|
661
|
+
aTextureMetadata.uvRegion = new Uint16Array([currentX + 1, 0, newX, aTextureMetadata.textureSize.height / newHeight * Math.pow(2, Uint16Array.BYTES_PER_ELEMENT * 8) - 1]);
|
|
662
|
+
currentX = newX;
|
|
663
|
+
}
|
|
680
664
|
}
|
|
681
665
|
} catch (err) {
|
|
682
|
-
|
|
666
|
+
_iterator11.e(err);
|
|
683
667
|
} finally {
|
|
684
|
-
|
|
668
|
+
_iterator11.f();
|
|
685
669
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
originalMaterialId: 'default'
|
|
695
|
-
}]
|
|
696
|
-
});
|
|
670
|
+
newMaterial.texture.image.width = newWidth;
|
|
671
|
+
newMaterial.texture.image.height = newHeight;
|
|
672
|
+
}
|
|
673
|
+
_iterator12 = _createForOfIteratorHelper(mergedIndices.reverse());
|
|
674
|
+
try {
|
|
675
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
676
|
+
index = _step12.value;
|
|
677
|
+
materials.splice(index, 1);
|
|
697
678
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
679
|
+
} catch (err) {
|
|
680
|
+
_iterator12.e(err);
|
|
681
|
+
} finally {
|
|
682
|
+
_iterator12.f();
|
|
683
|
+
}
|
|
684
|
+
result.push(newMaterial);
|
|
685
|
+
_context5.next = 1;
|
|
686
|
+
break;
|
|
687
|
+
case 21:
|
|
688
|
+
if (!result.length) {
|
|
689
|
+
result.push({
|
|
690
|
+
material: getDefaultMaterial(),
|
|
691
|
+
mergedMaterials: [{
|
|
692
|
+
originalMaterialId: 'default'
|
|
693
|
+
}]
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
return _context5.abrupt("return", result);
|
|
697
|
+
case 23:
|
|
698
|
+
case "end":
|
|
699
|
+
return _context5.stop();
|
|
703
700
|
}
|
|
704
701
|
}, _callee5);
|
|
705
702
|
}));
|
|
@@ -713,49 +710,47 @@ function _mergeMaterials() {
|
|
|
713
710
|
var _material1$texture, _material2$texture;
|
|
714
711
|
var buffer1, buffer2, _yield$import, joinImages, sharpData;
|
|
715
712
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
716
|
-
while (1) {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
_context6.next = 21;
|
|
721
|
-
break;
|
|
722
|
-
}
|
|
723
|
-
buffer1 = Buffer.from(material1.texture.bufferView.data);
|
|
724
|
-
buffer2 = Buffer.from(material2.texture.bufferView.data);
|
|
725
|
-
_context6.prev = 3;
|
|
726
|
-
_context6.next = 6;
|
|
727
|
-
return Promise.resolve().then(function () {
|
|
728
|
-
return _interopRequireWildcard(require('join-images'));
|
|
729
|
-
});
|
|
730
|
-
case 6:
|
|
731
|
-
_yield$import = _context6.sent;
|
|
732
|
-
joinImages = _yield$import.joinImages;
|
|
733
|
-
_context6.next = 10;
|
|
734
|
-
return joinImages([buffer1, buffer2], {
|
|
735
|
-
direction: 'horizontal'
|
|
736
|
-
});
|
|
737
|
-
case 10:
|
|
738
|
-
sharpData = _context6.sent;
|
|
739
|
-
_context6.next = 13;
|
|
740
|
-
return sharpData.toFormat(material1.texture.mimeType === 'image/png' ? 'png' : 'jpeg').toBuffer();
|
|
741
|
-
case 13:
|
|
742
|
-
material1.texture.bufferView.data = _context6.sent;
|
|
743
|
-
_context6.next = 20;
|
|
713
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
714
|
+
case 0:
|
|
715
|
+
if (!((_material1$texture = material1.texture) !== null && _material1$texture !== void 0 && _material1$texture.bufferView && (_material2$texture = material2.texture) !== null && _material2$texture !== void 0 && _material2$texture.bufferView && material1.mergedMaterials && material2.mergedMaterials)) {
|
|
716
|
+
_context6.next = 21;
|
|
744
717
|
break;
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
718
|
+
}
|
|
719
|
+
buffer1 = Buffer.from(material1.texture.bufferView.data);
|
|
720
|
+
buffer2 = Buffer.from(material2.texture.bufferView.data);
|
|
721
|
+
_context6.prev = 3;
|
|
722
|
+
_context6.next = 6;
|
|
723
|
+
return Promise.resolve().then(function () {
|
|
724
|
+
return _interopRequireWildcard(require('join-images'));
|
|
725
|
+
});
|
|
726
|
+
case 6:
|
|
727
|
+
_yield$import = _context6.sent;
|
|
728
|
+
joinImages = _yield$import.joinImages;
|
|
729
|
+
_context6.next = 10;
|
|
730
|
+
return joinImages([buffer1, buffer2], {
|
|
731
|
+
direction: 'horizontal'
|
|
732
|
+
});
|
|
733
|
+
case 10:
|
|
734
|
+
sharpData = _context6.sent;
|
|
735
|
+
_context6.next = 13;
|
|
736
|
+
return sharpData.toFormat(material1.texture.mimeType === 'image/png' ? 'png' : 'jpeg').toBuffer();
|
|
737
|
+
case 13:
|
|
738
|
+
material1.texture.bufferView.data = _context6.sent;
|
|
739
|
+
_context6.next = 20;
|
|
740
|
+
break;
|
|
741
|
+
case 16:
|
|
742
|
+
_context6.prev = 16;
|
|
743
|
+
_context6.t0 = _context6["catch"](3);
|
|
744
|
+
console.log('Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)');
|
|
745
|
+
throw _context6.t0;
|
|
746
|
+
case 20:
|
|
747
|
+
material1.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId = 1;
|
|
748
|
+
case 21:
|
|
749
|
+
material1.mergedMaterials = material1.mergedMaterials.concat(material2.mergedMaterials);
|
|
750
|
+
return _context6.abrupt("return", material1);
|
|
751
|
+
case 23:
|
|
752
|
+
case "end":
|
|
753
|
+
return _context6.stop();
|
|
759
754
|
}
|
|
760
755
|
}, _callee6, null, [[3, 16]]);
|
|
761
756
|
}));
|
|
@@ -809,7 +804,6 @@ function convertMaterial(sourceMaterial) {
|
|
|
809
804
|
mergedMaterials: mergedMaterials
|
|
810
805
|
};
|
|
811
806
|
}
|
|
812
|
-
|
|
813
807
|
function convertAlphaMode(gltfAlphaMode) {
|
|
814
808
|
switch (gltfAlphaMode) {
|
|
815
809
|
case 'OPAQUE':
|
|
@@ -822,7 +816,6 @@ function convertAlphaMode(gltfAlphaMode) {
|
|
|
822
816
|
return 'opaque';
|
|
823
817
|
}
|
|
824
818
|
}
|
|
825
|
-
|
|
826
819
|
function getDefaultMaterial() {
|
|
827
820
|
return {
|
|
828
821
|
alphaMode: 'opaque',
|
|
@@ -832,7 +825,6 @@ function getDefaultMaterial() {
|
|
|
832
825
|
}
|
|
833
826
|
};
|
|
834
827
|
}
|
|
835
|
-
|
|
836
828
|
function getSharedResources(gltfMaterials, nodeId) {
|
|
837
829
|
var i3sResources = {};
|
|
838
830
|
if (!gltfMaterials || !gltfMaterials.length) {
|
|
@@ -860,7 +852,6 @@ function getSharedResources(gltfMaterials, nodeId) {
|
|
|
860
852
|
}
|
|
861
853
|
return i3sResources;
|
|
862
854
|
}
|
|
863
|
-
|
|
864
855
|
function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
865
856
|
var _gltfMaterial$pbrMeta;
|
|
866
857
|
var texture = (gltfMaterial === null || gltfMaterial === void 0 ? void 0 : (_gltfMaterial$pbrMeta = gltfMaterial.pbrMetallicRoughness) === null || _gltfMaterial$pbrMeta === void 0 ? void 0 : _gltfMaterial$pbrMeta.baseColorTexture) || gltfMaterial.emissiveTexture;
|
|
@@ -881,7 +872,6 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
|
881
872
|
textureDefinitionInfo: textureDefinitionInfo
|
|
882
873
|
};
|
|
883
874
|
}
|
|
884
|
-
|
|
885
875
|
function extractSharedResourcesMaterialInfo(baseColorFactor) {
|
|
886
876
|
var metallicFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
887
877
|
var matDielectricColorComponent = 0.04 / 255;
|
|
@@ -901,7 +891,6 @@ function extractSharedResourcesMaterialInfo(baseColorFactor) {
|
|
|
901
891
|
}
|
|
902
892
|
};
|
|
903
893
|
}
|
|
904
|
-
|
|
905
894
|
function extractSharedResourcesTextureInfo(texture, nodeId) {
|
|
906
895
|
var _texture$source, _texture$source2, _texture$source3;
|
|
907
896
|
return {
|
|
@@ -913,7 +902,6 @@ function extractSharedResourcesTextureInfo(texture, nodeId) {
|
|
|
913
902
|
}]
|
|
914
903
|
};
|
|
915
904
|
}
|
|
916
|
-
|
|
917
905
|
function generateImageId(texture, nodeId) {
|
|
918
906
|
var _texture$source4;
|
|
919
907
|
var _texture$source$image = (_texture$source4 = texture.source) === null || _texture$source4 === void 0 ? void 0 : _texture$source4.image,
|
|
@@ -932,13 +920,11 @@ function generateImageId(texture, nodeId) {
|
|
|
932
920
|
var imageId = BigInt("0b".concat(leftHalf.toString(2)).concat(rightHalf));
|
|
933
921
|
return imageId.toString();
|
|
934
922
|
}
|
|
935
|
-
|
|
936
923
|
function makeFeatureIdsUnique(featureIds, featureIndices, featuresHashArray, batchTable) {
|
|
937
924
|
var replaceMap = getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray);
|
|
938
925
|
replaceIndicesByUnique(featureIndices, replaceMap);
|
|
939
926
|
replaceIndicesByUnique(featureIds, replaceMap);
|
|
940
927
|
}
|
|
941
|
-
|
|
942
928
|
function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
|
|
943
929
|
var featureMap = {};
|
|
944
930
|
for (var index = 0; index < featureIds.length; index++) {
|
|
@@ -948,7 +934,6 @@ function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
|
|
|
948
934
|
}
|
|
949
935
|
return featureMap;
|
|
950
936
|
}
|
|
951
|
-
|
|
952
937
|
function generateStringFromBatchTableByIndex(batchTable, index) {
|
|
953
938
|
var str = '';
|
|
954
939
|
for (var _key in batchTable) {
|
|
@@ -956,7 +941,6 @@ function generateStringFromBatchTableByIndex(batchTable, index) {
|
|
|
956
941
|
}
|
|
957
942
|
return str;
|
|
958
943
|
}
|
|
959
|
-
|
|
960
944
|
function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
|
|
961
945
|
var batchTableStr = generateStringFromBatchTableByIndex(batchTable, index);
|
|
962
946
|
var hash = (0, _md.default)(batchTableStr);
|
|
@@ -965,13 +949,11 @@ function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
|
|
|
965
949
|
}
|
|
966
950
|
return featuresHashArray.push(hash) - 1;
|
|
967
951
|
}
|
|
968
|
-
|
|
969
952
|
function replaceIndicesByUnique(indicesArray, featureMap) {
|
|
970
953
|
for (var index = 0; index < indicesArray.length; index++) {
|
|
971
954
|
indicesArray[index] = featureMap[indicesArray[index]];
|
|
972
955
|
}
|
|
973
956
|
}
|
|
974
|
-
|
|
975
957
|
function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo) {
|
|
976
958
|
var attributeBuffers = [];
|
|
977
959
|
var needFlattenPropertyTable = (0, _featureAttributes.checkPropertiesLength)(featureIds, propertyTable);
|
|
@@ -987,7 +969,6 @@ function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attri
|
|
|
987
969
|
}
|
|
988
970
|
return attributeBuffers;
|
|
989
971
|
}
|
|
990
|
-
|
|
991
972
|
function generateAttributeBuffer(type, value) {
|
|
992
973
|
var attributeBuffer;
|
|
993
974
|
switch (type) {
|
|
@@ -1006,27 +987,23 @@ function generateAttributeBuffer(type, value) {
|
|
|
1006
987
|
}
|
|
1007
988
|
return attributeBuffer;
|
|
1008
989
|
}
|
|
1009
|
-
|
|
1010
990
|
function getAttributeType(key, attributeStorageInfo) {
|
|
1011
991
|
var attribute = attributeStorageInfo.find(function (attr) {
|
|
1012
992
|
return attr.name === key;
|
|
1013
993
|
});
|
|
1014
994
|
return attribute.attributeValues.valueType;
|
|
1015
995
|
}
|
|
1016
|
-
|
|
1017
996
|
function generateShortIntegerAttributeBuffer(featureIds) {
|
|
1018
997
|
var count = new Uint32Array([featureIds.length]);
|
|
1019
998
|
var valuesArray = new Uint32Array(featureIds);
|
|
1020
999
|
return (0, _loaderUtils.concatenateArrayBuffers)(count.buffer, valuesArray.buffer);
|
|
1021
1000
|
}
|
|
1022
|
-
|
|
1023
1001
|
function generateDoubleAttributeBuffer(featureIds) {
|
|
1024
1002
|
var count = new Uint32Array([featureIds.length]);
|
|
1025
1003
|
var padding = new Uint8Array(4);
|
|
1026
1004
|
var valuesArray = new Float64Array(featureIds);
|
|
1027
1005
|
return (0, _loaderUtils.concatenateArrayBuffers)(count.buffer, padding.buffer, valuesArray.buffer);
|
|
1028
1006
|
}
|
|
1029
|
-
|
|
1030
1007
|
function generateStringAttributeBuffer(batchAttributes) {
|
|
1031
1008
|
var stringCountArray = new Uint32Array([batchAttributes.length]);
|
|
1032
1009
|
var totalNumberOfBytes = 0;
|
|
@@ -1043,7 +1020,6 @@ function generateStringAttributeBuffer(batchAttributes) {
|
|
|
1043
1020
|
var totalBytes = new Uint32Array([totalNumberOfBytes]);
|
|
1044
1021
|
return _loaderUtils.concatenateArrayBuffers.apply(void 0, [stringCountArray.buffer, totalBytes.buffer, stringSizesArray.buffer].concat(stringBufferArray));
|
|
1045
1022
|
}
|
|
1046
|
-
|
|
1047
1023
|
function generateBigUint64Array(featureIds) {
|
|
1048
1024
|
var typedFeatureIds = new BigUint64Array(featureIds.length);
|
|
1049
1025
|
for (var index = 0; index < featureIds.length; index++) {
|
|
@@ -1051,7 +1027,6 @@ function generateBigUint64Array(featureIds) {
|
|
|
1051
1027
|
}
|
|
1052
1028
|
return typedFeatureIds;
|
|
1053
1029
|
}
|
|
1054
|
-
|
|
1055
1030
|
function generateCompressedGeometry(_x18, _x19, _x20, _x21) {
|
|
1056
1031
|
return _generateCompressedGeometry.apply(this, arguments);
|
|
1057
1032
|
}
|
|
@@ -1059,53 +1034,51 @@ function _generateCompressedGeometry() {
|
|
|
1059
1034
|
_generateCompressedGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
|
|
1060
1035
|
var positions, normals, texCoords, colors, uvRegions, featureIds, faceRange, indices, index, featureIndices, featureIndex, compressedAttributes, attributesMetadata;
|
|
1061
1036
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1062
|
-
while (1) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1037
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1038
|
+
case 0:
|
|
1039
|
+
positions = attributes.positions, normals = attributes.normals, texCoords = attributes.texCoords, colors = attributes.colors, uvRegions = attributes.uvRegions, featureIds = attributes.featureIds, faceRange = attributes.faceRange;
|
|
1040
|
+
indices = new Uint32Array(vertexCount);
|
|
1041
|
+
for (index = 0; index < indices.length; index++) {
|
|
1042
|
+
indices.set([index], index);
|
|
1043
|
+
}
|
|
1044
|
+
featureIndices = new Uint32Array(convertedAttributes.featureIndices.length ? convertedAttributes.featureIndices : vertexCount);
|
|
1045
|
+
featureIndex = generateFeatureIndexAttribute(featureIndices, faceRange);
|
|
1046
|
+
compressedAttributes = {
|
|
1047
|
+
positions: positions,
|
|
1048
|
+
normals: normals,
|
|
1049
|
+
colors: colors,
|
|
1050
|
+
'feature-index': featureIndex
|
|
1051
|
+
};
|
|
1052
|
+
if (texCoords.length) {
|
|
1053
|
+
compressedAttributes.texCoords = texCoords;
|
|
1054
|
+
}
|
|
1055
|
+
attributesMetadata = {
|
|
1056
|
+
'feature-index': {
|
|
1057
|
+
'i3s-attribute-type': 'feature-index',
|
|
1058
|
+
'i3s-feature-ids': new Int32Array(featureIds)
|
|
1069
1059
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
compressedAttributes =
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
colors: colors,
|
|
1076
|
-
'feature-index': featureIndex
|
|
1060
|
+
};
|
|
1061
|
+
if (uvRegions.length) {
|
|
1062
|
+
compressedAttributes['uv-region'] = uvRegions;
|
|
1063
|
+
attributesMetadata['uv-region'] = {
|
|
1064
|
+
'i3s-attribute-type': 'uv-region'
|
|
1077
1065
|
};
|
|
1078
|
-
|
|
1079
|
-
|
|
1066
|
+
}
|
|
1067
|
+
return _context7.abrupt("return", (0, _core2.encode)({
|
|
1068
|
+
attributes: compressedAttributes,
|
|
1069
|
+
indices: indices
|
|
1070
|
+
}, _draco.DracoWriterWorker, _objectSpread(_objectSpread({}, _draco.DracoWriterWorker.options), {}, {
|
|
1071
|
+
source: dracoWorkerSoure,
|
|
1072
|
+
reuseWorkers: true,
|
|
1073
|
+
_nodeWorkers: true,
|
|
1074
|
+
draco: {
|
|
1075
|
+
method: 'MESH_SEQUENTIAL_ENCODING',
|
|
1076
|
+
attributesMetadata: attributesMetadata
|
|
1080
1077
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}
|
|
1086
|
-
};
|
|
1087
|
-
if (uvRegions.length) {
|
|
1088
|
-
compressedAttributes['uv-region'] = uvRegions;
|
|
1089
|
-
attributesMetadata['uv-region'] = {
|
|
1090
|
-
'i3s-attribute-type': 'uv-region'
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
return _context7.abrupt("return", (0, _core2.encode)({
|
|
1094
|
-
attributes: compressedAttributes,
|
|
1095
|
-
indices: indices
|
|
1096
|
-
}, _draco.DracoWriterWorker, _objectSpread(_objectSpread({}, _draco.DracoWriterWorker.options), {}, {
|
|
1097
|
-
source: dracoWorkerSoure,
|
|
1098
|
-
reuseWorkers: true,
|
|
1099
|
-
_nodeWorkers: true,
|
|
1100
|
-
draco: {
|
|
1101
|
-
method: 'MESH_SEQUENTIAL_ENCODING',
|
|
1102
|
-
attributesMetadata: attributesMetadata
|
|
1103
|
-
}
|
|
1104
|
-
})));
|
|
1105
|
-
case 10:
|
|
1106
|
-
case "end":
|
|
1107
|
-
return _context7.stop();
|
|
1108
|
-
}
|
|
1078
|
+
})));
|
|
1079
|
+
case 10:
|
|
1080
|
+
case "end":
|
|
1081
|
+
return _context7.stop();
|
|
1109
1082
|
}
|
|
1110
1083
|
}, _callee7);
|
|
1111
1084
|
}));
|
|
@@ -1123,7 +1096,6 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
|
|
|
1123
1096
|
}
|
|
1124
1097
|
return orderedFeatureIndices;
|
|
1125
1098
|
}
|
|
1126
|
-
|
|
1127
1099
|
function getPropertyTable(tileContent) {
|
|
1128
1100
|
var batchTableJson = tileContent === null || tileContent === void 0 ? void 0 : tileContent.batchTableJson;
|
|
1129
1101
|
if (batchTableJson) {
|
|
@@ -1146,7 +1118,6 @@ function getPropertyTable(tileContent) {
|
|
|
1146
1118
|
return null;
|
|
1147
1119
|
}
|
|
1148
1120
|
}
|
|
1149
|
-
|
|
1150
1121
|
function getPropertyTableExtension(tileContent) {
|
|
1151
1122
|
var _tileContent$gltf, _tileContent$gltf2, _tileContent$gltf2$ex, _tileContent$gltf3;
|
|
1152
1123
|
var extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
|
|
@@ -1179,7 +1150,6 @@ function getPropertyTableExtension(tileContent) {
|
|
|
1179
1150
|
extension: extension
|
|
1180
1151
|
};
|
|
1181
1152
|
}
|
|
1182
|
-
|
|
1183
1153
|
function getPropertyTableFromExtFeatureMetadata(extension) {
|
|
1184
1154
|
if (extension !== null && extension !== void 0 && extension.featureTextures) {
|
|
1185
1155
|
console.warn('The I3S converter does not yet support the EXT_feature_metadata feature textures');
|