@loaders.gl/tile-converter 3.2.0-alpha.1 → 3.2.0-alpha.2
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.d.ts +28 -0
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/3d-tiles-attributes-worker.js +4 -0
- package/dist/3d-tiles-attributes-worker.js.map +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +4 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +29 -3
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -4
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +10 -10
- package/dist/converter.min.js +20 -20
- package/dist/dist.min.js +789 -645
- package/dist/es5/3d-tiles-attributes-worker.js +29 -0
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +102 -43
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +21 -23
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +29 -0
- package/dist/es5/i3s-attributes-worker.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +267 -178
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +71 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +47 -99
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +230 -195
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/index.js +8 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +14 -17
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +39 -14
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +61 -0
- package/dist/es5/lib/utils/queue.js.map +1 -0
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +225 -0
- package/dist/es5/lib/utils/write-queue.js.map +1 -0
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +37 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/workers/i3s-attributes-worker.js +40 -0
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +16 -0
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +30 -4
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +16 -18
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +16 -0
- package/dist/esm/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +117 -58
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +54 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +12 -4
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +105 -28
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +6 -8
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +11 -1
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js +19 -0
- package/dist/esm/lib/utils/queue.js.map +1 -0
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +88 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -0
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +5 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/workers/i3s-attributes-worker.js +4 -0
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/i3s-attributes-worker.d.ts +33 -0
- package/dist/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/i3s-attributes-worker.js +10 -0
- package/dist/i3s-attributes-worker.js.map +7 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +7 -7
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +25 -21
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +2 -2
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +2 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +28 -11
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +220 -110
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/gltf-attributes.js +56 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +6 -5
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +13 -8
- package/dist/i3s-converter/i3s-converter.d.ts +7 -3
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +88 -26
- package/dist/i3s-converter/types.d.ts +83 -8
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/utils/compress-util.d.ts +44 -5
- package/dist/lib/utils/compress-util.d.ts.map +1 -1
- package/dist/lib/utils/compress-util.js +73 -6
- package/dist/lib/utils/file-utils.d.ts +34 -5
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +40 -1
- package/dist/lib/utils/lod-conversion-utils.d.ts +25 -4
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/lib/utils/lod-conversion-utils.js +21 -2
- package/dist/lib/utils/queue.d.ts +7 -0
- package/dist/lib/utils/queue.d.ts.map +1 -0
- package/dist/lib/utils/queue.js +18 -0
- package/dist/lib/utils/statistic-utills.d.ts +2 -2
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.d.ts +22 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -0
- package/dist/lib/utils/write-queue.js +62 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/workers/3d-tiles-attributes-worker.js +9 -0
- package/dist/workers/i3s-attributes-worker.d.ts +2 -0
- package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/workers/i3s-attributes-worker.js +5 -0
- package/package.json +20 -17
- package/src/3d-tiles-attributes-worker.ts +43 -0
- package/src/3d-tiles-converter/3d-tiles-converter.ts +44 -4
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +15 -13
- package/src/i3s-attributes-worker.ts +46 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +29 -24
- package/src/i3s-converter/helpers/geometry-attributes.ts +4 -3
- package/src/i3s-converter/helpers/{geometry-converter.js → geometry-converter.ts} +421 -175
- package/src/i3s-converter/helpers/gltf-attributes.ts +68 -0
- package/src/i3s-converter/helpers/node-pages.ts +25 -17
- package/src/i3s-converter/i3s-converter.ts +112 -69
- package/src/i3s-converter/types.ts +90 -8
- package/src/index.ts +1 -0
- package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
- package/src/lib/utils/file-utils.ts +84 -0
- package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
- package/src/lib/utils/queue.ts +17 -0
- package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
- package/src/lib/utils/write-queue.ts +75 -0
- package/src/workers/3d-tiles-attributes-worker.ts +6 -0
- package/src/workers/i3s-attributes-worker.ts +6 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/es5/lib/utils/compress-util.d.ts +0 -53
- package/dist/es5/lib/utils/file-utils.d.ts +0 -43
- package/dist/es5/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/esm/lib/utils/compress-util.d.ts +0 -53
- package/dist/esm/lib/utils/file-utils.d.ts +0 -43
- package/dist/esm/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/src/lib/utils/compress-util.d.ts +0 -53
- package/src/lib/utils/file-utils.d.ts +0 -43
- package/src/lib/utils/file-utils.js +0 -38
- package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = convertB3dmToI3sGeometry;
|
|
9
|
+
exports.convertAttributes = convertAttributes;
|
|
9
10
|
|
|
10
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
12
|
|
|
@@ -29,6 +30,8 @@ var _geometryAttributes = require("./geometry-attributes");
|
|
|
29
30
|
|
|
30
31
|
var _coordinateConverter = require("./coordinate-converter");
|
|
31
32
|
|
|
33
|
+
var _gltfAttributes = require("./gltf-attributes");
|
|
34
|
+
|
|
32
35
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
36
|
|
|
34
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -51,21 +54,28 @@ var OBJECT_ID_TYPE = 'Oid32';
|
|
|
51
54
|
var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ['CUSTOM_ATTRIBUTE_2', '_BATCHID', 'BATCHID'];
|
|
52
55
|
var scratchVector = new _core.Vector3();
|
|
53
56
|
|
|
54
|
-
function convertB3dmToI3sGeometry(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
|
57
|
+
function convertB3dmToI3sGeometry(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
55
58
|
return _convertB3dmToI3sGeometry.apply(this, arguments);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
function _convertB3dmToI3sGeometry() {
|
|
59
|
-
_convertB3dmToI3sGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tileContent, nodeId, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel) {
|
|
60
|
-
var
|
|
62
|
+
_convertB3dmToI3sGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tileContent, nodeId, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel, workerSource) {
|
|
63
|
+
var _tileContent$gltf;
|
|
64
|
+
|
|
65
|
+
var useCartesianPositions, materialAndTextureList, dataForAttributesConversion, convertedAttributesMap, result, nodesCounter, _ref3, _ref3$materials, materials, i, sourceMaterial, convertedAttributes, _materialAndTextureLi, material, texture;
|
|
61
66
|
|
|
62
67
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
63
68
|
while (1) {
|
|
64
69
|
switch (_context.prev = _context.next) {
|
|
65
70
|
case 0:
|
|
66
71
|
useCartesianPositions = generateBoundingVolumes;
|
|
67
|
-
materialAndTextureList = convertMaterials(tileContent);
|
|
68
|
-
|
|
72
|
+
materialAndTextureList = convertMaterials((_tileContent$gltf = tileContent.gltf) === null || _tileContent$gltf === void 0 ? void 0 : _tileContent$gltf.materials);
|
|
73
|
+
dataForAttributesConversion = (0, _gltfAttributes.prepareDataForAttributesConversion)(tileContent);
|
|
74
|
+
_context.next = 5;
|
|
75
|
+
return convertAttributes(dataForAttributesConversion, useCartesianPositions);
|
|
76
|
+
|
|
77
|
+
case 5:
|
|
78
|
+
convertedAttributesMap = _context.sent;
|
|
69
79
|
|
|
70
80
|
if (generateBoundingVolumes) {
|
|
71
81
|
_generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
|
|
@@ -79,7 +89,9 @@ function _convertB3dmToI3sGeometry() {
|
|
|
79
89
|
|
|
80
90
|
result = [];
|
|
81
91
|
nodesCounter = nodeId;
|
|
82
|
-
|
|
92
|
+
_ref3 = tileContent.gltf || {
|
|
93
|
+
materials: []
|
|
94
|
+
}, _ref3$materials = _ref3.materials, materials = _ref3$materials === void 0 ? [] : _ref3$materials;
|
|
83
95
|
|
|
84
96
|
if (!(materials !== null && materials !== void 0 && materials.length)) {
|
|
85
97
|
materials.push({
|
|
@@ -89,26 +101,35 @@ function _convertB3dmToI3sGeometry() {
|
|
|
89
101
|
|
|
90
102
|
i = 0;
|
|
91
103
|
|
|
92
|
-
case
|
|
104
|
+
case 13:
|
|
93
105
|
if (!(i < materials.length)) {
|
|
94
|
-
_context.next =
|
|
106
|
+
_context.next = 30;
|
|
95
107
|
break;
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
sourceMaterial = materials[i];
|
|
99
111
|
|
|
100
112
|
if (convertedAttributesMap.has(sourceMaterial.id)) {
|
|
101
|
-
_context.next =
|
|
113
|
+
_context.next = 17;
|
|
102
114
|
break;
|
|
103
115
|
}
|
|
104
116
|
|
|
105
|
-
return _context.abrupt("continue",
|
|
117
|
+
return _context.abrupt("continue", 27);
|
|
106
118
|
|
|
107
|
-
case
|
|
119
|
+
case 17:
|
|
108
120
|
convertedAttributes = convertedAttributesMap.get(sourceMaterial.id);
|
|
121
|
+
|
|
122
|
+
if (convertedAttributes) {
|
|
123
|
+
_context.next = 20;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return _context.abrupt("continue", 27);
|
|
128
|
+
|
|
129
|
+
case 20:
|
|
109
130
|
_materialAndTextureLi = materialAndTextureList[i], material = _materialAndTextureLi.material, texture = _materialAndTextureLi.texture;
|
|
110
131
|
_context.t0 = result;
|
|
111
|
-
_context.next =
|
|
132
|
+
_context.next = 24;
|
|
112
133
|
return _makeNodeResources({
|
|
113
134
|
convertedAttributes: convertedAttributes,
|
|
114
135
|
material: material,
|
|
@@ -117,33 +138,34 @@ function _convertB3dmToI3sGeometry() {
|
|
|
117
138
|
nodeId: nodesCounter,
|
|
118
139
|
featuresHashArray: featuresHashArray,
|
|
119
140
|
attributeStorageInfo: attributeStorageInfo,
|
|
120
|
-
draco: draco
|
|
141
|
+
draco: draco,
|
|
142
|
+
workerSource: workerSource
|
|
121
143
|
});
|
|
122
144
|
|
|
123
|
-
case
|
|
145
|
+
case 24:
|
|
124
146
|
_context.t1 = _context.sent;
|
|
125
147
|
|
|
126
148
|
_context.t0.push.call(_context.t0, _context.t1);
|
|
127
149
|
|
|
128
150
|
nodesCounter++;
|
|
129
151
|
|
|
130
|
-
case
|
|
152
|
+
case 27:
|
|
131
153
|
i++;
|
|
132
|
-
_context.next =
|
|
154
|
+
_context.next = 13;
|
|
133
155
|
break;
|
|
134
156
|
|
|
135
|
-
case
|
|
157
|
+
case 30:
|
|
136
158
|
if (result.length) {
|
|
137
|
-
_context.next =
|
|
159
|
+
_context.next = 32;
|
|
138
160
|
break;
|
|
139
161
|
}
|
|
140
162
|
|
|
141
163
|
return _context.abrupt("return", null);
|
|
142
164
|
|
|
143
|
-
case
|
|
165
|
+
case 32:
|
|
144
166
|
return _context.abrupt("return", result);
|
|
145
167
|
|
|
146
|
-
case
|
|
168
|
+
case 33:
|
|
147
169
|
case "end":
|
|
148
170
|
return _context.stop();
|
|
149
171
|
}
|
|
@@ -181,25 +203,24 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
181
203
|
}
|
|
182
204
|
}
|
|
183
205
|
|
|
184
|
-
function _makeNodeResources(
|
|
206
|
+
function _makeNodeResources(_x9) {
|
|
185
207
|
return _makeNodeResources2.apply(this, arguments);
|
|
186
208
|
}
|
|
187
209
|
|
|
188
210
|
function _makeNodeResources2() {
|
|
189
211
|
_makeNodeResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(_ref) {
|
|
190
|
-
var
|
|
212
|
+
var _tileContent$gltf2;
|
|
213
|
+
|
|
214
|
+
var convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, attributeStorageInfo, draco, workerSource, boundingVolumes, vertexCount, _generateAttributes, faceRange, featureIds, positions, normals, colors, texCoords, featureCount, header, typedFeatureIds, fileBuffer, compressedGeometry, attributes;
|
|
191
215
|
|
|
192
216
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
193
217
|
while (1) {
|
|
194
218
|
switch (_context2.prev = _context2.next) {
|
|
195
219
|
case 0:
|
|
196
|
-
convertedAttributes = _ref.convertedAttributes, material = _ref.material, texture = _ref.texture, tileContent = _ref.tileContent, nodeId = _ref.nodeId, featuresHashArray = _ref.featuresHashArray, attributeStorageInfo = _ref.attributeStorageInfo, draco = _ref.draco;
|
|
220
|
+
convertedAttributes = _ref.convertedAttributes, material = _ref.material, texture = _ref.texture, tileContent = _ref.tileContent, nodeId = _ref.nodeId, featuresHashArray = _ref.featuresHashArray, attributeStorageInfo = _ref.attributeStorageInfo, draco = _ref.draco, workerSource = _ref.workerSource;
|
|
197
221
|
boundingVolumes = convertedAttributes.boundingVolumes;
|
|
198
222
|
vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX;
|
|
199
|
-
|
|
200
|
-
_generateAttributes = (0, _geometryAttributes.generateAttributes)(_objectSpread({
|
|
201
|
-
triangleCount: triangleCount
|
|
202
|
-
}, convertedAttributes)), faceRange = _generateAttributes.faceRange, featureIds = _generateAttributes.featureIds, positions = _generateAttributes.positions, normals = _generateAttributes.normals, colors = _generateAttributes.colors, texCoords = _generateAttributes.texCoords, featureCount = _generateAttributes.featureCount;
|
|
223
|
+
_generateAttributes = (0, _geometryAttributes.generateAttributes)(convertedAttributes), faceRange = _generateAttributes.faceRange, featureIds = _generateAttributes.featureIds, positions = _generateAttributes.positions, normals = _generateAttributes.normals, colors = _generateAttributes.colors, texCoords = _generateAttributes.texCoords, featureCount = _generateAttributes.featureCount;
|
|
203
224
|
|
|
204
225
|
if (tileContent.batchTableJson) {
|
|
205
226
|
makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, tileContent.batchTableJson);
|
|
@@ -209,38 +230,20 @@ function _makeNodeResources2() {
|
|
|
209
230
|
typedFeatureIds = generateBigUint64Array(featureIds);
|
|
210
231
|
header.set([vertexCount, featureCount], 0);
|
|
211
232
|
fileBuffer = new Uint8Array((0, _loaderUtils.concatenateArrayBuffers)(header.buffer, positions.buffer, normals.buffer, texture ? texCoords.buffer : new ArrayBuffer(0), colors.buffer, typedFeatureIds.buffer, faceRange.buffer));
|
|
212
|
-
|
|
213
|
-
if (!draco) {
|
|
214
|
-
_context2.next = 16;
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
_context2.next = 13;
|
|
219
|
-
return generateCompressedGeometry(vertexCount, convertedAttributes, {
|
|
233
|
+
compressedGeometry = draco ? generateCompressedGeometry(vertexCount, convertedAttributes, {
|
|
220
234
|
positions: positions,
|
|
221
235
|
normals: normals,
|
|
222
236
|
texCoords: texture ? texCoords : new Float32Array(0),
|
|
223
237
|
colors: colors,
|
|
224
238
|
featureIds: featureIds,
|
|
225
239
|
faceRange: faceRange
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
case 13:
|
|
229
|
-
_context2.t0 = _context2.sent;
|
|
230
|
-
_context2.next = 17;
|
|
231
|
-
break;
|
|
232
|
-
|
|
233
|
-
case 16:
|
|
234
|
-
_context2.t0 = null;
|
|
235
|
-
|
|
236
|
-
case 17:
|
|
237
|
-
compressedGeometry = _context2.t0;
|
|
240
|
+
}, workerSource.draco) : null;
|
|
238
241
|
attributes = convertBatchTableToAttributeBuffers(tileContent.batchTableJson, featureIds, attributeStorageInfo);
|
|
239
242
|
return _context2.abrupt("return", {
|
|
240
243
|
geometry: fileBuffer,
|
|
241
244
|
compressedGeometry: compressedGeometry,
|
|
242
245
|
texture: texture,
|
|
243
|
-
sharedResources: getSharedResources(tileContent, nodeId),
|
|
246
|
+
sharedResources: getSharedResources(((_tileContent$gltf2 = tileContent.gltf) === null || _tileContent$gltf2 === void 0 ? void 0 : _tileContent$gltf2.materials) || [], nodeId),
|
|
244
247
|
meshMaterial: material,
|
|
245
248
|
vertexCount: vertexCount,
|
|
246
249
|
attributes: attributes,
|
|
@@ -248,7 +251,7 @@ function _makeNodeResources2() {
|
|
|
248
251
|
boundingVolumes: boundingVolumes
|
|
249
252
|
});
|
|
250
253
|
|
|
251
|
-
case
|
|
254
|
+
case 12:
|
|
252
255
|
case "end":
|
|
253
256
|
return _context2.stop();
|
|
254
257
|
}
|
|
@@ -258,79 +261,132 @@ function _makeNodeResources2() {
|
|
|
258
261
|
return _makeNodeResources2.apply(this, arguments);
|
|
259
262
|
}
|
|
260
263
|
|
|
261
|
-
function convertAttributes(
|
|
262
|
-
|
|
264
|
+
function convertAttributes(_x10, _x11) {
|
|
265
|
+
return _convertAttributes.apply(this, arguments);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function _convertAttributes() {
|
|
269
|
+
_convertAttributes = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(attributesData, useCartesianPositions) {
|
|
270
|
+
var gltfMaterials, nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, _iterator6, _step6, material, _iterator7, _step7, attrKey, attributes;
|
|
263
271
|
|
|
264
|
-
|
|
272
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
273
|
+
while (1) {
|
|
274
|
+
switch (_context3.prev = _context3.next) {
|
|
275
|
+
case 0:
|
|
276
|
+
gltfMaterials = attributesData.gltfMaterials, nodes = attributesData.nodes, cartographicOrigin = attributesData.cartographicOrigin, cartesianModelMatrix = attributesData.cartesianModelMatrix;
|
|
277
|
+
attributesMap = new Map();
|
|
278
|
+
_iterator6 = _createForOfIteratorHelper(gltfMaterials || [{
|
|
279
|
+
id: 'default'
|
|
280
|
+
}]);
|
|
281
|
+
|
|
282
|
+
try {
|
|
283
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
284
|
+
material = _step6.value;
|
|
285
|
+
attributesMap.set(material.id, {
|
|
286
|
+
positions: new Float32Array(0),
|
|
287
|
+
normals: new Float32Array(0),
|
|
288
|
+
texCoords: new Float32Array(0),
|
|
289
|
+
colors: new Uint8Array(0),
|
|
290
|
+
featureIndicesGroups: [],
|
|
291
|
+
featureIndices: [],
|
|
292
|
+
boundingVolumes: null
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
} catch (err) {
|
|
296
|
+
_iterator6.e(err);
|
|
297
|
+
} finally {
|
|
298
|
+
_iterator6.f();
|
|
299
|
+
}
|
|
265
300
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
_step2;
|
|
301
|
+
convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
302
|
+
_iterator7 = _createForOfIteratorHelper(attributesMap.keys());
|
|
303
|
+
_context3.prev = 6;
|
|
270
304
|
|
|
271
|
-
|
|
272
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
273
|
-
var material = _step2.value;
|
|
274
|
-
attributesMap.set(material.id, {
|
|
275
|
-
positions: new Float32Array(0),
|
|
276
|
-
normals: new Float32Array(0),
|
|
277
|
-
texCoords: new Float32Array(0),
|
|
278
|
-
colors: new Uint8Array(0),
|
|
279
|
-
featureIndices: [],
|
|
280
|
-
boundingVolumes: null
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
} catch (err) {
|
|
284
|
-
_iterator2.e(err);
|
|
285
|
-
} finally {
|
|
286
|
-
_iterator2.f();
|
|
287
|
-
}
|
|
305
|
+
_iterator7.s();
|
|
288
306
|
|
|
289
|
-
|
|
290
|
-
|
|
307
|
+
case 8:
|
|
308
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
309
|
+
_context3.next = 19;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
291
312
|
|
|
292
|
-
|
|
293
|
-
|
|
313
|
+
attrKey = _step7.value;
|
|
314
|
+
attributes = attributesMap.get(attrKey);
|
|
294
315
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
316
|
+
if (attributes) {
|
|
317
|
+
_context3.next = 13;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
299
320
|
|
|
300
|
-
|
|
301
|
-
attributesMap.delete(attrKey);
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
321
|
+
return _context3.abrupt("continue", 17);
|
|
304
322
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
_iterator3.e(err);
|
|
311
|
-
} finally {
|
|
312
|
-
_iterator3.f();
|
|
313
|
-
}
|
|
323
|
+
case 13:
|
|
324
|
+
if (!(attributes.positions.length === 0)) {
|
|
325
|
+
_context3.next = 16;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
314
328
|
|
|
315
|
-
|
|
329
|
+
attributesMap.delete(attrKey);
|
|
330
|
+
return _context3.abrupt("continue", 17);
|
|
331
|
+
|
|
332
|
+
case 16:
|
|
333
|
+
if (attributes.featureIndicesGroups) {
|
|
334
|
+
attributes.featureIndices = attributes.featureIndicesGroups.reduce(function (acc, value) {
|
|
335
|
+
return acc.concat(value);
|
|
336
|
+
});
|
|
337
|
+
delete attributes.featureIndicesGroups;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
case 17:
|
|
341
|
+
_context3.next = 8;
|
|
342
|
+
break;
|
|
343
|
+
|
|
344
|
+
case 19:
|
|
345
|
+
_context3.next = 24;
|
|
346
|
+
break;
|
|
347
|
+
|
|
348
|
+
case 21:
|
|
349
|
+
_context3.prev = 21;
|
|
350
|
+
_context3.t0 = _context3["catch"](6);
|
|
351
|
+
|
|
352
|
+
_iterator7.e(_context3.t0);
|
|
353
|
+
|
|
354
|
+
case 24:
|
|
355
|
+
_context3.prev = 24;
|
|
356
|
+
|
|
357
|
+
_iterator7.f();
|
|
358
|
+
|
|
359
|
+
return _context3.finish(24);
|
|
360
|
+
|
|
361
|
+
case 27:
|
|
362
|
+
return _context3.abrupt("return", attributesMap);
|
|
363
|
+
|
|
364
|
+
case 28:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context3.stop();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, _callee3, null, [[6, 21, 24, 27]]);
|
|
370
|
+
}));
|
|
371
|
+
return _convertAttributes.apply(this, arguments);
|
|
316
372
|
}
|
|
317
373
|
|
|
318
|
-
function convertNodes(nodes,
|
|
319
|
-
var matrix = arguments.length >
|
|
374
|
+
function convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
|
|
375
|
+
var matrix = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
320
376
|
|
|
321
377
|
if (nodes) {
|
|
322
|
-
var
|
|
323
|
-
|
|
378
|
+
var _iterator2 = _createForOfIteratorHelper(nodes),
|
|
379
|
+
_step2;
|
|
324
380
|
|
|
325
381
|
try {
|
|
326
|
-
for (
|
|
327
|
-
var node =
|
|
328
|
-
convertNode(node,
|
|
382
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
383
|
+
var node = _step2.value;
|
|
384
|
+
convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
|
|
329
385
|
}
|
|
330
386
|
} catch (err) {
|
|
331
|
-
|
|
387
|
+
_iterator2.e(err);
|
|
332
388
|
} finally {
|
|
333
|
-
|
|
389
|
+
_iterator2.f();
|
|
334
390
|
}
|
|
335
391
|
}
|
|
336
392
|
}
|
|
@@ -361,28 +417,30 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
361
417
|
return transformationMatrix;
|
|
362
418
|
}
|
|
363
419
|
|
|
364
|
-
function convertNode(node,
|
|
365
|
-
var matrix = arguments.length >
|
|
420
|
+
function convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
|
|
421
|
+
var matrix = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
366
422
|
var transformationMatrix = getCompositeTransformationMatrix(node, matrix);
|
|
367
423
|
var mesh = node.mesh;
|
|
368
424
|
|
|
369
425
|
if (mesh) {
|
|
370
|
-
convertMesh(mesh,
|
|
426
|
+
convertMesh(mesh, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
371
427
|
}
|
|
372
428
|
|
|
373
|
-
convertNodes(node.children,
|
|
429
|
+
convertNodes(node.children || [], cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
374
430
|
}
|
|
375
431
|
|
|
376
|
-
function convertMesh(mesh,
|
|
377
|
-
var useCartesianPositions = arguments.length >
|
|
378
|
-
var matrix = arguments.length >
|
|
432
|
+
function convertMesh(mesh, cartographicOrigin, cartesianModelMatrix, attributesMap) {
|
|
433
|
+
var useCartesianPositions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
434
|
+
var matrix = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
379
435
|
|
|
380
|
-
var
|
|
381
|
-
|
|
436
|
+
var _iterator3 = _createForOfIteratorHelper(mesh.primitives),
|
|
437
|
+
_step3;
|
|
382
438
|
|
|
383
439
|
try {
|
|
384
|
-
for (
|
|
385
|
-
var
|
|
440
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
441
|
+
var _primitive$indices, _primitive$indices2, _primitive$indices3, _primitive$indices4, _primitive$indices5;
|
|
442
|
+
|
|
443
|
+
var primitive = _step3.value;
|
|
386
444
|
var outputAttributes = null;
|
|
387
445
|
|
|
388
446
|
if (primitive.material) {
|
|
@@ -393,32 +451,38 @@ function convertMesh(mesh, content, attributesMap) {
|
|
|
393
451
|
|
|
394
452
|
(0, _core2.assert)(outputAttributes !== null, 'Primitive - material mapping failed');
|
|
395
453
|
var attributes = primitive.attributes;
|
|
454
|
+
|
|
455
|
+
if (!outputAttributes) {
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
|
|
396
459
|
outputAttributes.positions = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.positions, transformVertexArray({
|
|
397
460
|
vertices: attributes.POSITION.value,
|
|
398
|
-
cartographicOrigin:
|
|
399
|
-
cartesianModelMatrix:
|
|
461
|
+
cartographicOrigin: cartographicOrigin,
|
|
462
|
+
cartesianModelMatrix: cartesianModelMatrix,
|
|
400
463
|
nodeMatrix: matrix,
|
|
401
|
-
indices: primitive.indices.value,
|
|
464
|
+
indices: (_primitive$indices = primitive.indices) === null || _primitive$indices === void 0 ? void 0 : _primitive$indices.value,
|
|
402
465
|
attributeSpecificTransformation: transformVertexPositions,
|
|
403
466
|
useCartesianPositions: useCartesianPositions
|
|
404
467
|
}));
|
|
405
468
|
outputAttributes.normals = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.normals, transformVertexArray({
|
|
406
469
|
vertices: attributes.NORMAL && attributes.NORMAL.value,
|
|
407
|
-
cartographicOrigin:
|
|
408
|
-
cartesianModelMatrix:
|
|
470
|
+
cartographicOrigin: cartographicOrigin,
|
|
471
|
+
cartesianModelMatrix: cartesianModelMatrix,
|
|
409
472
|
nodeMatrix: matrix,
|
|
410
|
-
indices: primitive.indices.value,
|
|
473
|
+
indices: (_primitive$indices2 = primitive.indices) === null || _primitive$indices2 === void 0 ? void 0 : _primitive$indices2.value,
|
|
411
474
|
attributeSpecificTransformation: transformVertexNormals,
|
|
412
475
|
useCartesianPositions: false
|
|
413
476
|
}));
|
|
414
|
-
outputAttributes.texCoords = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, primitive.indices.value));
|
|
415
|
-
outputAttributes.colors = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.colors, flattenColors(attributes.COLOR_0, primitive.indices.value));
|
|
416
|
-
outputAttributes.
|
|
477
|
+
outputAttributes.texCoords = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, (_primitive$indices3 = primitive.indices) === null || _primitive$indices3 === void 0 ? void 0 : _primitive$indices3.value));
|
|
478
|
+
outputAttributes.colors = (0, _loaderUtils.concatenateTypedArrays)(outputAttributes.colors, flattenColors(attributes.COLOR_0, (_primitive$indices4 = primitive.indices) === null || _primitive$indices4 === void 0 ? void 0 : _primitive$indices4.value));
|
|
479
|
+
outputAttributes.featureIndicesGroups = outputAttributes.featureIndicesGroups || [];
|
|
480
|
+
outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIdsByAttributeName(attributes), (_primitive$indices5 = primitive.indices) === null || _primitive$indices5 === void 0 ? void 0 : _primitive$indices5.value));
|
|
417
481
|
}
|
|
418
482
|
} catch (err) {
|
|
419
|
-
|
|
483
|
+
_iterator3.e(err);
|
|
420
484
|
} finally {
|
|
421
|
-
|
|
485
|
+
_iterator3.f();
|
|
422
486
|
}
|
|
423
487
|
}
|
|
424
488
|
|
|
@@ -553,36 +617,36 @@ function getBatchIdsByAttributeName(attributes) {
|
|
|
553
617
|
return batchIds;
|
|
554
618
|
}
|
|
555
619
|
|
|
556
|
-
function convertMaterials(
|
|
620
|
+
function convertMaterials() {
|
|
621
|
+
var sourceMaterials = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
557
622
|
var result = [];
|
|
558
|
-
var sourceMaterials = tileContent.gltf.materials || [];
|
|
559
623
|
|
|
560
|
-
var
|
|
561
|
-
|
|
624
|
+
var _iterator4 = _createForOfIteratorHelper(sourceMaterials),
|
|
625
|
+
_step4;
|
|
562
626
|
|
|
563
627
|
try {
|
|
564
|
-
for (
|
|
565
|
-
var sourceMaterial =
|
|
628
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
629
|
+
var sourceMaterial = _step4.value;
|
|
566
630
|
result.push(convertMaterial(sourceMaterial));
|
|
567
631
|
}
|
|
568
632
|
} catch (err) {
|
|
569
|
-
|
|
633
|
+
_iterator4.e(err);
|
|
570
634
|
} finally {
|
|
571
|
-
|
|
635
|
+
_iterator4.f();
|
|
572
636
|
}
|
|
573
637
|
|
|
574
638
|
return result;
|
|
575
639
|
}
|
|
576
640
|
|
|
577
641
|
function convertMaterial(sourceMaterial) {
|
|
578
|
-
var _sourceMaterial$pbrMe, _sourceMaterial$pbrMe2, _sourceMaterial$pbrMe3;
|
|
642
|
+
var _sourceMaterial$emiss, _sourceMaterial$pbrMe, _sourceMaterial$pbrMe2, _sourceMaterial$pbrMe3;
|
|
579
643
|
|
|
580
644
|
var material = {
|
|
581
645
|
doubleSided: sourceMaterial.doubleSided,
|
|
582
|
-
emissiveFactor: sourceMaterial.emissiveFactor.map(function (c) {
|
|
646
|
+
emissiveFactor: (_sourceMaterial$emiss = sourceMaterial.emissiveFactor) === null || _sourceMaterial$emiss === void 0 ? void 0 : _sourceMaterial$emiss.map(function (c) {
|
|
583
647
|
return Math.round(c * 255);
|
|
584
648
|
}),
|
|
585
|
-
alphaMode: (sourceMaterial.alphaMode
|
|
649
|
+
alphaMode: convertAlphaMode(sourceMaterial.alphaMode),
|
|
586
650
|
pbrMetallicRoughness: {
|
|
587
651
|
roughnessFactor: (sourceMaterial === null || sourceMaterial === void 0 ? void 0 : (_sourceMaterial$pbrMe = sourceMaterial.pbrMetallicRoughness) === null || _sourceMaterial$pbrMe === void 0 ? void 0 : _sourceMaterial$pbrMe.roughnessFactor) || DEFAULT_ROUGHNESS_FACTOR,
|
|
588
652
|
metallicFactor: (sourceMaterial === null || sourceMaterial === void 0 ? void 0 : (_sourceMaterial$pbrMe2 = sourceMaterial.pbrMetallicRoughness) === null || _sourceMaterial$pbrMe2 === void 0 ? void 0 : _sourceMaterial$pbrMe2.metallicFactor) || DEFAULT_METALLIC_FACTOR
|
|
@@ -617,15 +681,33 @@ function convertMaterial(sourceMaterial) {
|
|
|
617
681
|
};
|
|
618
682
|
}
|
|
619
683
|
|
|
684
|
+
function convertAlphaMode(gltfAlphaMode) {
|
|
685
|
+
switch (gltfAlphaMode) {
|
|
686
|
+
case 'OPAQUE':
|
|
687
|
+
return 'opaque';
|
|
688
|
+
|
|
689
|
+
case 'MASK':
|
|
690
|
+
return 'mask';
|
|
691
|
+
|
|
692
|
+
case 'BLEND':
|
|
693
|
+
return 'blend';
|
|
694
|
+
|
|
695
|
+
default:
|
|
696
|
+
return 'opaque';
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
620
700
|
function getDefaultMaterial() {
|
|
621
701
|
return {
|
|
622
702
|
alphaMode: 'opaque',
|
|
623
|
-
pbrMetallicRoughness: {
|
|
703
|
+
pbrMetallicRoughness: {
|
|
704
|
+
metallicFactor: 1,
|
|
705
|
+
roughnessFactor: 1
|
|
706
|
+
}
|
|
624
707
|
};
|
|
625
708
|
}
|
|
626
709
|
|
|
627
|
-
function getSharedResources(
|
|
628
|
-
var gltfMaterials = tileContent.gltf.materials;
|
|
710
|
+
function getSharedResources(gltfMaterials, nodeId) {
|
|
629
711
|
var i3sResources = {};
|
|
630
712
|
|
|
631
713
|
if (!gltfMaterials || !gltfMaterials.length) {
|
|
@@ -634,12 +716,12 @@ function getSharedResources(tileContent, nodeId) {
|
|
|
634
716
|
|
|
635
717
|
i3sResources.materialDefinitionInfos = [];
|
|
636
718
|
|
|
637
|
-
var
|
|
638
|
-
|
|
719
|
+
var _iterator5 = _createForOfIteratorHelper(gltfMaterials),
|
|
720
|
+
_step5;
|
|
639
721
|
|
|
640
722
|
try {
|
|
641
|
-
for (
|
|
642
|
-
var gltfMaterial =
|
|
723
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
724
|
+
var gltfMaterial = _step5.value;
|
|
643
725
|
|
|
644
726
|
var _convertGLTFMaterialT = convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId),
|
|
645
727
|
materialDefinitionInfo = _convertGLTFMaterialT.materialDefinitionInfo,
|
|
@@ -653,9 +735,9 @@ function getSharedResources(tileContent, nodeId) {
|
|
|
653
735
|
}
|
|
654
736
|
}
|
|
655
737
|
} catch (err) {
|
|
656
|
-
|
|
738
|
+
_iterator5.e(err);
|
|
657
739
|
} finally {
|
|
658
|
-
|
|
740
|
+
_iterator5.f();
|
|
659
741
|
}
|
|
660
742
|
|
|
661
743
|
return i3sResources;
|
|
@@ -683,7 +765,7 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
|
683
765
|
}
|
|
684
766
|
|
|
685
767
|
return {
|
|
686
|
-
materialDefinitionInfo: extractSharedResourcesMaterialInfo(colorFactor, metallicFactor),
|
|
768
|
+
materialDefinitionInfo: extractSharedResourcesMaterialInfo(colorFactor || [1, 1, 1, 1], metallicFactor),
|
|
687
769
|
textureDefinitionInfo: textureDefinitionInfo
|
|
688
770
|
};
|
|
689
771
|
}
|
|
@@ -700,26 +782,34 @@ function extractSharedResourcesMaterialInfo(baseColorFactor) {
|
|
|
700
782
|
dielectricSpecular[3] = 1;
|
|
701
783
|
var specular = dielectricSpecular.lerp(dielectricSpecular, baseColorVector, metallicFactor);
|
|
702
784
|
return {
|
|
703
|
-
|
|
704
|
-
|
|
785
|
+
params: {
|
|
786
|
+
diffuse: diffuse.toArray(),
|
|
787
|
+
specular: specular.toArray(),
|
|
788
|
+
renderMode: 'solid'
|
|
789
|
+
}
|
|
705
790
|
};
|
|
706
791
|
}
|
|
707
792
|
|
|
708
793
|
function extractSharedResourcesTextureInfo(texture, nodeId) {
|
|
794
|
+
var _texture$source, _texture$source2, _texture$source3;
|
|
795
|
+
|
|
709
796
|
return {
|
|
710
|
-
encoding: [texture.source.mimeType],
|
|
797
|
+
encoding: texture !== null && texture !== void 0 && (_texture$source = texture.source) !== null && _texture$source !== void 0 && _texture$source.mimeType ? [texture.source.mimeType] : undefined,
|
|
711
798
|
images: [{
|
|
712
799
|
id: generateImageId(texture, nodeId),
|
|
713
|
-
size: texture.source.image.width,
|
|
714
|
-
length: [texture.source.image.data.length]
|
|
800
|
+
size: (_texture$source2 = texture.source) === null || _texture$source2 === void 0 ? void 0 : _texture$source2.image.width,
|
|
801
|
+
length: [(_texture$source3 = texture.source) === null || _texture$source3 === void 0 ? void 0 : _texture$source3.image.data.length]
|
|
715
802
|
}]
|
|
716
803
|
};
|
|
717
804
|
}
|
|
718
805
|
|
|
719
806
|
function generateImageId(texture, nodeId) {
|
|
720
|
-
var _texture$
|
|
807
|
+
var _texture$source4;
|
|
808
|
+
|
|
809
|
+
var _texture$source$image = (_texture$source4 = texture.source) === null || _texture$source4 === void 0 ? void 0 : _texture$source4.image,
|
|
721
810
|
width = _texture$source$image.width,
|
|
722
811
|
height = _texture$source$image.height;
|
|
812
|
+
|
|
723
813
|
var levelCountOfTexture = 1;
|
|
724
814
|
var indexOfLevel = 0;
|
|
725
815
|
var indexOfTextureInStore = nodeId + 1;
|
|
@@ -755,8 +845,8 @@ function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
|
|
|
755
845
|
function generateStringFromBatchTableByIndex(batchTable, index) {
|
|
756
846
|
var str = '';
|
|
757
847
|
|
|
758
|
-
for (var
|
|
759
|
-
str += batchTable[
|
|
848
|
+
for (var _key in batchTable) {
|
|
849
|
+
str += batchTable[_key][index];
|
|
760
850
|
}
|
|
761
851
|
|
|
762
852
|
return str;
|
|
@@ -787,29 +877,31 @@ function convertBatchTableToAttributeBuffers(batchTable, featureIds, attributeSt
|
|
|
787
877
|
OBJECTID: featureIds
|
|
788
878
|
}, batchTable);
|
|
789
879
|
|
|
790
|
-
for (var
|
|
791
|
-
var type = getAttributeType(
|
|
880
|
+
for (var _key2 in batchTableWithFeatureIds) {
|
|
881
|
+
var type = getAttributeType(_key2, attributeStorageInfo);
|
|
792
882
|
var attributeBuffer = null;
|
|
793
883
|
|
|
794
884
|
switch (type) {
|
|
795
885
|
case OBJECT_ID_TYPE:
|
|
796
886
|
case SHORT_INT_TYPE:
|
|
797
|
-
attributeBuffer = generateShortIntegerAttributeBuffer(batchTableWithFeatureIds[
|
|
887
|
+
attributeBuffer = generateShortIntegerAttributeBuffer(batchTableWithFeatureIds[_key2]);
|
|
798
888
|
break;
|
|
799
889
|
|
|
800
890
|
case DOUBLE_TYPE:
|
|
801
|
-
attributeBuffer = generateDoubleAttributeBuffer(batchTableWithFeatureIds[
|
|
891
|
+
attributeBuffer = generateDoubleAttributeBuffer(batchTableWithFeatureIds[_key2]);
|
|
802
892
|
break;
|
|
803
893
|
|
|
804
894
|
case STRING_TYPE:
|
|
805
|
-
attributeBuffer = generateStringAttributeBuffer(batchTableWithFeatureIds[
|
|
895
|
+
attributeBuffer = generateStringAttributeBuffer(batchTableWithFeatureIds[_key2]);
|
|
806
896
|
break;
|
|
807
897
|
|
|
808
898
|
default:
|
|
809
|
-
attributeBuffer = generateStringAttributeBuffer(batchTableWithFeatureIds[
|
|
899
|
+
attributeBuffer = generateStringAttributeBuffer(batchTableWithFeatureIds[_key2]);
|
|
810
900
|
}
|
|
811
901
|
|
|
812
|
-
|
|
902
|
+
if (attributeBuffer) {
|
|
903
|
+
attributeBuffers.push(attributeBuffer);
|
|
904
|
+
}
|
|
813
905
|
}
|
|
814
906
|
}
|
|
815
907
|
|
|
@@ -865,16 +957,16 @@ function generateBigUint64Array(featureIds) {
|
|
|
865
957
|
return typedFeatureIds;
|
|
866
958
|
}
|
|
867
959
|
|
|
868
|
-
function generateCompressedGeometry(
|
|
960
|
+
function generateCompressedGeometry(_x12, _x13, _x14, _x15) {
|
|
869
961
|
return _generateCompressedGeometry.apply(this, arguments);
|
|
870
962
|
}
|
|
871
963
|
|
|
872
964
|
function _generateCompressedGeometry() {
|
|
873
|
-
_generateCompressedGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function
|
|
965
|
+
_generateCompressedGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
|
|
874
966
|
var positions, normals, texCoords, colors, featureIds, faceRange, indices, index, featureIndices, featureIndex, compressedAttributes, attributesMetadata;
|
|
875
|
-
return _regenerator.default.wrap(function
|
|
967
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
876
968
|
while (1) {
|
|
877
|
-
switch (
|
|
969
|
+
switch (_context4.prev = _context4.next) {
|
|
878
970
|
case 0:
|
|
879
971
|
positions = attributes.positions, normals = attributes.normals, texCoords = attributes.texCoords, colors = attributes.colors, featureIds = attributes.featureIds, faceRange = attributes.faceRange;
|
|
880
972
|
indices = new Uint32Array(vertexCount);
|
|
@@ -902,28 +994,25 @@ function _generateCompressedGeometry() {
|
|
|
902
994
|
'i3s-feature-ids': new Int32Array(featureIds)
|
|
903
995
|
}
|
|
904
996
|
};
|
|
905
|
-
|
|
906
|
-
_context3.next = 11;
|
|
907
|
-
return (0, _core2.encode)({
|
|
997
|
+
return _context4.abrupt("return", (0, _core2.encode)({
|
|
908
998
|
attributes: compressedAttributes,
|
|
909
999
|
indices: indices
|
|
910
|
-
}, _draco.
|
|
1000
|
+
}, _draco.DracoWriterWorker, _objectSpread(_objectSpread({}, _draco.DracoWriterWorker.options), {}, {
|
|
1001
|
+
source: dracoWorkerSoure,
|
|
1002
|
+
reuseWorkers: true,
|
|
1003
|
+
_nodeWorkers: true,
|
|
911
1004
|
draco: {
|
|
912
1005
|
method: 'MESH_SEQUENTIAL_ENCODING',
|
|
913
1006
|
attributesMetadata: attributesMetadata
|
|
914
1007
|
}
|
|
915
|
-
});
|
|
1008
|
+
})));
|
|
916
1009
|
|
|
917
|
-
case
|
|
918
|
-
_context3.t1 = _context3.sent;
|
|
919
|
-
return _context3.abrupt("return", new _context3.t0(_context3.t1));
|
|
920
|
-
|
|
921
|
-
case 13:
|
|
1010
|
+
case 9:
|
|
922
1011
|
case "end":
|
|
923
|
-
return
|
|
1012
|
+
return _context4.stop();
|
|
924
1013
|
}
|
|
925
1014
|
}
|
|
926
|
-
},
|
|
1015
|
+
}, _callee4);
|
|
927
1016
|
}));
|
|
928
1017
|
return _generateCompressedGeometry.apply(this, arguments);
|
|
929
1018
|
}
|