@loaders.gl/i3s 3.4.0-alpha.2 → 3.4.0-alpha.3

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.
Files changed (76) hide show
  1. package/dist/dist.min.js +180 -15
  2. package/dist/es5/arcgis-webscene-loader.js +7 -11
  3. package/dist/es5/arcgis-webscene-loader.js.map +1 -1
  4. package/dist/es5/i3s-attribute-loader.js +51 -63
  5. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  6. package/dist/es5/i3s-building-scene-layer-loader.js +13 -16
  7. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  8. package/dist/es5/i3s-content-loader.js +19 -22
  9. package/dist/es5/i3s-content-loader.js.map +1 -1
  10. package/dist/es5/i3s-loader.js +86 -94
  11. package/dist/es5/i3s-loader.js.map +1 -1
  12. package/dist/es5/i3s-node-page-loader.js +14 -18
  13. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  14. package/dist/es5/index.js.map +1 -1
  15. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +109 -124
  16. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  17. package/dist/es5/lib/parsers/constants.js +4 -5
  18. package/dist/es5/lib/parsers/constants.js.map +1 -1
  19. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +99 -107
  20. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
  21. package/dist/es5/lib/parsers/parse-i3s-attribute.js +14 -21
  22. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
  23. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +13 -17
  24. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  25. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +166 -187
  26. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  27. package/dist/es5/lib/parsers/parse-i3s.js +31 -35
  28. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
  29. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  30. package/dist/es5/lib/utils/customizeColors.js +102 -107
  31. package/dist/es5/lib/utils/customizeColors.js.map +1 -1
  32. package/dist/es5/lib/utils/url-utils.js +0 -2
  33. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  34. package/dist/es5/types.js +8 -8
  35. package/dist/es5/types.js.map +1 -1
  36. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -1
  37. package/dist/es5/workers/i3s-content-worker.js.map +1 -1
  38. package/dist/esm/arcgis-webscene-loader.js +1 -4
  39. package/dist/esm/arcgis-webscene-loader.js.map +1 -1
  40. package/dist/esm/bundle.js +0 -1
  41. package/dist/esm/bundle.js.map +1 -1
  42. package/dist/esm/i3s-attribute-loader.js +2 -14
  43. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  44. package/dist/esm/i3s-building-scene-layer-loader.js +1 -2
  45. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  46. package/dist/esm/i3s-content-loader.js +1 -2
  47. package/dist/esm/i3s-content-loader.js.map +1 -1
  48. package/dist/esm/i3s-loader.js +1 -3
  49. package/dist/esm/i3s-loader.js.map +1 -1
  50. package/dist/esm/i3s-node-page-loader.js +1 -3
  51. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  52. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +0 -8
  53. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  54. package/dist/esm/lib/parsers/constants.js +3 -4
  55. package/dist/esm/lib/parsers/constants.js.map +1 -1
  56. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +0 -4
  57. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -1
  58. package/dist/esm/lib/parsers/parse-i3s-attribute.js +0 -7
  59. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
  60. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +0 -3
  61. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  62. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +0 -21
  63. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  64. package/dist/esm/lib/parsers/parse-i3s.js +2 -8
  65. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
  66. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  67. package/dist/esm/lib/utils/customizeColors.js +0 -4
  68. package/dist/esm/lib/utils/customizeColors.js.map +1 -1
  69. package/dist/esm/lib/utils/url-utils.js +0 -3
  70. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  71. package/dist/esm/types.js +6 -6
  72. package/dist/esm/types.js.map +1 -1
  73. package/dist/i3s-content-nodejs-worker.js +57 -57
  74. package/dist/i3s-content-nodejs-worker.js.map +3 -3
  75. package/dist/i3s-content-worker.js +170 -25
  76. package/package.json +8 -8
@@ -21,7 +21,7 @@ var _constants = require("./constants");
21
21
  var _customizeColors = require("../utils/customizeColors");
22
22
  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; } } }; }
23
23
  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); }
24
- 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; }
24
+ 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; }
25
25
  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; }
26
26
  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; }
27
27
  var scratchVector = new _core2.Vector3([0, 0, 0]);
@@ -46,100 +46,98 @@ function _parseI3STileContent() {
46
46
  _parseI3STileContent = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, tileOptions, tilesetOptions, options, context) {
47
47
  var content, _options$i3s, url, loader, response, _arrayBuffer, _options, texture;
48
48
  return _regenerator.default.wrap(function _callee$(_context) {
49
- while (1) {
50
- switch (_context.prev = _context.next) {
51
- case 0:
52
- content = {
53
- attributes: {},
54
- indices: null,
55
- featureIds: [],
56
- vertexCount: 0,
57
- modelMatrix: new _core2.Matrix4(),
58
- coordinateSystem: 0,
59
- byteLength: 0,
60
- texture: null
61
- };
62
- if (!tileOptions.textureUrl) {
63
- _context.next = 35;
64
- break;
65
- }
66
- url = (0, _urlUtils.getUrlWithToken)(tileOptions.textureUrl, options === null || options === void 0 ? void 0 : (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
67
- loader = getLoaderForTextureFormat(tileOptions.textureFormat);
68
- _context.next = 6;
69
- return fetch(url, options === null || options === void 0 ? void 0 : options.fetch);
70
- case 6:
71
- response = _context.sent;
72
- _context.next = 9;
73
- return response.arrayBuffer();
74
- case 9:
75
- _arrayBuffer = _context.sent;
76
- if (!(options !== null && options !== void 0 && options.i3s.decodeTextures)) {
77
- _context.next = 34;
78
- break;
79
- }
80
- if (!(loader === _images.ImageLoader)) {
81
- _context.next = 26;
82
- break;
83
- }
84
- _options = _objectSpread(_objectSpread({}, tileOptions.textureLoaderOptions), {}, {
85
- image: {
86
- type: 'data'
87
- }
88
- });
89
- _context.prev = 13;
90
- _context.next = 16;
91
- return context.parse(_arrayBuffer, _options);
92
- case 16:
93
- content.texture = _context.sent;
94
- _context.next = 24;
49
+ while (1) switch (_context.prev = _context.next) {
50
+ case 0:
51
+ content = {
52
+ attributes: {},
53
+ indices: null,
54
+ featureIds: [],
55
+ vertexCount: 0,
56
+ modelMatrix: new _core2.Matrix4(),
57
+ coordinateSystem: 0,
58
+ byteLength: 0,
59
+ texture: null
60
+ };
61
+ if (!tileOptions.textureUrl) {
62
+ _context.next = 35;
95
63
  break;
96
- case 19:
97
- _context.prev = 19;
98
- _context.t0 = _context["catch"](13);
99
- _context.next = 23;
100
- return (0, _core.parse)(_arrayBuffer, loader, _options);
101
- case 23:
102
- content.texture = _context.sent;
103
- case 24:
104
- _context.next = 32;
64
+ }
65
+ url = (0, _urlUtils.getUrlWithToken)(tileOptions.textureUrl, options === null || options === void 0 ? void 0 : (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
66
+ loader = getLoaderForTextureFormat(tileOptions.textureFormat);
67
+ _context.next = 6;
68
+ return fetch(url, options === null || options === void 0 ? void 0 : options.fetch);
69
+ case 6:
70
+ response = _context.sent;
71
+ _context.next = 9;
72
+ return response.arrayBuffer();
73
+ case 9:
74
+ _arrayBuffer = _context.sent;
75
+ if (!(options !== null && options !== void 0 && options.i3s.decodeTextures)) {
76
+ _context.next = 34;
105
77
  break;
106
- case 26:
107
- if (!(loader === _textures.CompressedTextureLoader || loader === _textures.BasisLoader)) {
108
- _context.next = 32;
109
- break;
110
- }
111
- _context.next = 29;
112
- return (0, _core.load)(_arrayBuffer, loader, tileOptions.textureLoaderOptions);
113
- case 29:
114
- texture = _context.sent;
115
- if (loader === _textures.BasisLoader) {
116
- texture = texture[0];
117
- }
118
- content.texture = {
119
- compressed: true,
120
- mipmaps: false,
121
- width: texture[0].width,
122
- height: texture[0].height,
123
- data: texture
124
- };
125
- case 32:
126
- _context.next = 35;
78
+ }
79
+ if (!(loader === _images.ImageLoader)) {
80
+ _context.next = 26;
127
81
  break;
128
- case 34:
129
- content.texture = _arrayBuffer;
130
- case 35:
131
- content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
132
- if (content.material) {
133
- content.texture = null;
82
+ }
83
+ _options = _objectSpread(_objectSpread({}, tileOptions.textureLoaderOptions), {}, {
84
+ image: {
85
+ type: 'data'
134
86
  }
135
- _context.next = 39;
136
- return parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
137
- case 39:
138
- return _context.abrupt("return", _context.sent);
139
- case 40:
140
- case "end":
141
- return _context.stop();
142
- }
87
+ });
88
+ _context.prev = 13;
89
+ _context.next = 16;
90
+ return context.parse(_arrayBuffer, _options);
91
+ case 16:
92
+ content.texture = _context.sent;
93
+ _context.next = 24;
94
+ break;
95
+ case 19:
96
+ _context.prev = 19;
97
+ _context.t0 = _context["catch"](13);
98
+ _context.next = 23;
99
+ return (0, _core.parse)(_arrayBuffer, loader, _options);
100
+ case 23:
101
+ content.texture = _context.sent;
102
+ case 24:
103
+ _context.next = 32;
104
+ break;
105
+ case 26:
106
+ if (!(loader === _textures.CompressedTextureLoader || loader === _textures.BasisLoader)) {
107
+ _context.next = 32;
108
+ break;
109
+ }
110
+ _context.next = 29;
111
+ return (0, _core.load)(_arrayBuffer, loader, tileOptions.textureLoaderOptions);
112
+ case 29:
113
+ texture = _context.sent;
114
+ if (loader === _textures.BasisLoader) {
115
+ texture = texture[0];
116
+ }
117
+ content.texture = {
118
+ compressed: true,
119
+ mipmaps: false,
120
+ width: texture[0].width,
121
+ height: texture[0].height,
122
+ data: texture
123
+ };
124
+ case 32:
125
+ _context.next = 35;
126
+ break;
127
+ case 34:
128
+ content.texture = _arrayBuffer;
129
+ case 35:
130
+ content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
131
+ if (content.material) {
132
+ content.texture = null;
133
+ }
134
+ _context.next = 39;
135
+ return parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
136
+ case 39:
137
+ return _context.abrupt("return", _context.sent);
138
+ case 40:
139
+ case "end":
140
+ return _context.stop();
143
141
  }
144
142
  }, _callee, null, [[13, 19]]);
145
143
  }));
@@ -153,90 +151,86 @@ function _parseI3SNodeGeometry() {
153
151
  var _options$i3s2;
154
152
  var contentByteLength, attributes, vertexCount, byteOffset, featureCount, indices, _decompressedGeometry, decompressedGeometry, _decompressedGeometry2, POSITION, NORMAL, COLOR_0, TEXCOORD_0, featureIndex, uvRegion, featureIds, _tilesetOptions$store, vertexAttributes, attributesOrder, featureAttributes, featureAttributeOrder, headers, _normalizeAttributes, normalizedVertexAttributes, offset, _normalizeAttributes2, normalizedFeatureAttributes, enuMatrix, attributeIndex;
155
153
  return _regenerator.default.wrap(function _callee2$(_context2) {
156
- while (1) {
157
- switch (_context2.prev = _context2.next) {
158
- case 0:
159
- contentByteLength = arrayBuffer.byteLength;
160
- byteOffset = 0;
161
- featureCount = 0;
162
- if (!tileOptions.isDracoGeometry) {
163
- _context2.next = 16;
164
- break;
165
- }
166
- _context2.next = 6;
167
- return (0, _core.parse)(arrayBuffer, _draco.DracoLoader, {
168
- draco: {
169
- attributeNameEntry: I3S_ATTRIBUTE_TYPE
170
- }
171
- });
172
- case 6:
173
- decompressedGeometry = _context2.sent;
174
- vertexCount = decompressedGeometry.header.vertexCount;
175
- indices = (_decompressedGeometry = decompressedGeometry.indices) === null || _decompressedGeometry === void 0 ? void 0 : _decompressedGeometry.value;
176
- _decompressedGeometry2 = decompressedGeometry.attributes, POSITION = _decompressedGeometry2.POSITION, NORMAL = _decompressedGeometry2.NORMAL, COLOR_0 = _decompressedGeometry2.COLOR_0, TEXCOORD_0 = _decompressedGeometry2.TEXCOORD_0, featureIndex = _decompressedGeometry2['feature-index'], uvRegion = _decompressedGeometry2['uv-region'];
177
- attributes = {
178
- position: POSITION,
179
- normal: NORMAL,
180
- color: COLOR_0,
181
- uv0: TEXCOORD_0,
182
- uvRegion: uvRegion,
183
- id: featureIndex
184
- };
185
- updateAttributesMetadata(attributes, decompressedGeometry);
186
- featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
187
- if (featureIds) {
188
- flattenFeatureIdsByFeatureIndices(attributes, featureIds);
189
- }
190
- _context2.next = 25;
154
+ while (1) switch (_context2.prev = _context2.next) {
155
+ case 0:
156
+ contentByteLength = arrayBuffer.byteLength;
157
+ byteOffset = 0;
158
+ featureCount = 0;
159
+ if (!tileOptions.isDracoGeometry) {
160
+ _context2.next = 16;
191
161
  break;
192
- case 16:
193
- _tilesetOptions$store = tilesetOptions.store.defaultGeometrySchema, vertexAttributes = _tilesetOptions$store.vertexAttributes, attributesOrder = _tilesetOptions$store.ordering, featureAttributes = _tilesetOptions$store.featureAttributes, featureAttributeOrder = _tilesetOptions$store.featureAttributeOrder;
194
- headers = parseHeaders(arrayBuffer, tilesetOptions);
195
- byteOffset = headers.byteOffset;
196
- vertexCount = headers.vertexCount;
197
- featureCount = headers.featureCount;
198
- _normalizeAttributes = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder), normalizedVertexAttributes = _normalizeAttributes.attributes, offset = _normalizeAttributes.byteOffset;
199
- _normalizeAttributes2 = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder), normalizedFeatureAttributes = _normalizeAttributes2.attributes;
200
- flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
201
- attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
202
- case 25:
203
- if (!(options !== null && options !== void 0 && (_options$i3s2 = options.i3s) !== null && _options$i3s2 !== void 0 && _options$i3s2.coordinateSystem) || options.i3s.coordinateSystem === _constants.COORDINATE_SYSTEM.METER_OFFSETS) {
204
- enuMatrix = parsePositions(attributes.position, tileOptions);
205
- content.modelMatrix = enuMatrix.invert();
206
- content.coordinateSystem = _constants.COORDINATE_SYSTEM.METER_OFFSETS;
207
- } else {
208
- content.modelMatrix = getModelMatrix(attributes.position);
209
- content.coordinateSystem = _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS;
210
- }
211
- _context2.next = 28;
212
- return (0, _customizeColors.customizeColors)(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
213
- case 28:
214
- attributes.color = _context2.sent;
215
- content.attributes = {
216
- positions: attributes.position,
217
- normals: attributes.normal,
218
- colors: normalizeAttribute(attributes.color),
219
- texCoords: attributes.uv0,
220
- uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
221
- };
222
-
223
- content.indices = indices || null;
224
- if (attributes.id && attributes.id.value) {
225
- content.featureIds = attributes.id.value;
162
+ }
163
+ _context2.next = 6;
164
+ return (0, _core.parse)(arrayBuffer, _draco.DracoLoader, {
165
+ draco: {
166
+ attributeNameEntry: I3S_ATTRIBUTE_TYPE
226
167
  }
227
-
228
- for (attributeIndex in content.attributes) {
229
- if (!content.attributes[attributeIndex]) {
230
- delete content.attributes[attributeIndex];
231
- }
168
+ });
169
+ case 6:
170
+ decompressedGeometry = _context2.sent;
171
+ vertexCount = decompressedGeometry.header.vertexCount;
172
+ indices = (_decompressedGeometry = decompressedGeometry.indices) === null || _decompressedGeometry === void 0 ? void 0 : _decompressedGeometry.value;
173
+ _decompressedGeometry2 = decompressedGeometry.attributes, POSITION = _decompressedGeometry2.POSITION, NORMAL = _decompressedGeometry2.NORMAL, COLOR_0 = _decompressedGeometry2.COLOR_0, TEXCOORD_0 = _decompressedGeometry2.TEXCOORD_0, featureIndex = _decompressedGeometry2['feature-index'], uvRegion = _decompressedGeometry2['uv-region'];
174
+ attributes = {
175
+ position: POSITION,
176
+ normal: NORMAL,
177
+ color: COLOR_0,
178
+ uv0: TEXCOORD_0,
179
+ uvRegion: uvRegion,
180
+ id: featureIndex
181
+ };
182
+ updateAttributesMetadata(attributes, decompressedGeometry);
183
+ featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
184
+ if (featureIds) {
185
+ flattenFeatureIdsByFeatureIndices(attributes, featureIds);
186
+ }
187
+ _context2.next = 25;
188
+ break;
189
+ case 16:
190
+ _tilesetOptions$store = tilesetOptions.store.defaultGeometrySchema, vertexAttributes = _tilesetOptions$store.vertexAttributes, attributesOrder = _tilesetOptions$store.ordering, featureAttributes = _tilesetOptions$store.featureAttributes, featureAttributeOrder = _tilesetOptions$store.featureAttributeOrder;
191
+ headers = parseHeaders(arrayBuffer, tilesetOptions);
192
+ byteOffset = headers.byteOffset;
193
+ vertexCount = headers.vertexCount;
194
+ featureCount = headers.featureCount;
195
+ _normalizeAttributes = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder), normalizedVertexAttributes = _normalizeAttributes.attributes, offset = _normalizeAttributes.byteOffset;
196
+ _normalizeAttributes2 = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder), normalizedFeatureAttributes = _normalizeAttributes2.attributes;
197
+ flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
198
+ attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
199
+ case 25:
200
+ if (!(options !== null && options !== void 0 && (_options$i3s2 = options.i3s) !== null && _options$i3s2 !== void 0 && _options$i3s2.coordinateSystem) || options.i3s.coordinateSystem === _constants.COORDINATE_SYSTEM.METER_OFFSETS) {
201
+ enuMatrix = parsePositions(attributes.position, tileOptions);
202
+ content.modelMatrix = enuMatrix.invert();
203
+ content.coordinateSystem = _constants.COORDINATE_SYSTEM.METER_OFFSETS;
204
+ } else {
205
+ content.modelMatrix = getModelMatrix(attributes.position);
206
+ content.coordinateSystem = _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS;
207
+ }
208
+ _context2.next = 28;
209
+ return (0, _customizeColors.customizeColors)(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
210
+ case 28:
211
+ attributes.color = _context2.sent;
212
+ content.attributes = {
213
+ positions: attributes.position,
214
+ normals: attributes.normal,
215
+ colors: normalizeAttribute(attributes.color),
216
+ texCoords: attributes.uv0,
217
+ uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
218
+ };
219
+ content.indices = indices || null;
220
+ if (attributes.id && attributes.id.value) {
221
+ content.featureIds = attributes.id.value;
222
+ }
223
+ for (attributeIndex in content.attributes) {
224
+ if (!content.attributes[attributeIndex]) {
225
+ delete content.attributes[attributeIndex];
232
226
  }
233
- content.vertexCount = vertexCount;
234
- content.byteLength = contentByteLength;
235
- return _context2.abrupt("return", content);
236
- case 36:
237
- case "end":
238
- return _context2.stop();
239
- }
227
+ }
228
+ content.vertexCount = vertexCount;
229
+ content.byteLength = contentByteLength;
230
+ return _context2.abrupt("return", content);
231
+ case 36:
232
+ case "end":
233
+ return _context2.stop();
240
234
  }
241
235
  }, _callee2);
242
236
  }));
@@ -257,11 +251,9 @@ function updateAttributesMetadata(attributes, decompressedGeometry) {
257
251
  }
258
252
  }
259
253
  }
260
-
261
254
  function concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes) {
262
255
  return _objectSpread(_objectSpread({}, normalizedVertexAttributes), normalizedFeatureAttributes);
263
256
  }
264
-
265
257
  function normalizeAttribute(attribute) {
266
258
  if (!attribute) {
267
259
  return attribute;
@@ -305,10 +297,8 @@ function parseHeaders(arrayBuffer, options) {
305
297
  byteOffset: byteOffset
306
298
  };
307
299
  }
308
-
309
300
  function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
310
301
  var attributes = {};
311
-
312
302
  var _iterator2 = _createForOfIteratorHelper(attributesOrder),
313
303
  _step2;
314
304
  try {
@@ -357,7 +347,6 @@ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attribut
357
347
  byteOffset: byteOffset
358
348
  };
359
349
  }
360
-
361
350
  function parseUint64Values(buffer, elementsCount, attributeSize) {
362
351
  var values = [];
363
352
  var dataView = new DataView(buffer);
@@ -383,7 +372,6 @@ function parsePositions(attribute, options) {
383
372
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
384
373
  return enuMatrix;
385
374
  }
386
-
387
375
  function offsetsToCartesians(vertices) {
388
376
  var metadata = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
389
377
  var cartographicOrigin = arguments.length > 2 ? arguments[2] : undefined;
@@ -403,7 +391,6 @@ function offsetsToCartesians(vertices) {
403
391
  }
404
392
  return positions;
405
393
  }
406
-
407
394
  function getModelMatrix(positions) {
408
395
  var _metadata$i3sScale_x, _metadata$i3sScale_y;
409
396
  var metadata = positions.metadata;
@@ -414,7 +401,6 @@ function getModelMatrix(positions) {
414
401
  modelMatrix[5] = scaleY;
415
402
  return modelMatrix;
416
403
  }
417
-
418
404
  function makePbrMaterial(materialDefinition, texture) {
419
405
  var pbrMaterial;
420
406
  if (materialDefinition) {
@@ -435,12 +421,10 @@ function makePbrMaterial(materialDefinition, texture) {
435
421
  pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];
436
422
  }
437
423
  }
438
-
439
424
  pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;
440
425
  if (pbrMaterial.alphaMode) {
441
426
  pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();
442
427
  }
443
-
444
428
  if (pbrMaterial.emissiveFactor) {
445
429
  pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);
446
430
  }
@@ -452,7 +436,6 @@ function makePbrMaterial(materialDefinition, texture) {
452
436
  }
453
437
  return pbrMaterial;
454
438
  }
455
-
456
439
  function convertColorFormat(colorFactor) {
457
440
  var normalizedColor = (0, _toConsumableArray2.default)(colorFactor);
458
441
  for (var index = 0; index < colorFactor.length; index++) {
@@ -460,7 +443,6 @@ function convertColorFormat(colorFactor) {
460
443
  }
461
444
  return normalizedColor;
462
445
  }
463
-
464
446
  function setMaterialTexture(material, image) {
465
447
  var texture = {
466
448
  source: {
@@ -489,7 +471,6 @@ function setMaterialTexture(material, image) {
489
471
  });
490
472
  }
491
473
  }
492
-
493
474
  function flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes) {
494
475
  var id = normalizedFeatureAttributes.id,
495
476
  faceRange = normalizedFeatureAttributes.faceRange;
@@ -514,7 +495,6 @@ function flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes) {
514
495
  }
515
496
  normalizedFeatureAttributes.id.value = orderedFeatureIndices;
516
497
  }
517
-
518
498
  function flattenFeatureIdsByFeatureIndices(attributes, featureIds) {
519
499
  var featureIndices = attributes.id.value;
520
500
  var result = new Float32Array(featureIndices.length);
@@ -523,7 +503,6 @@ function flattenFeatureIdsByFeatureIndices(attributes, featureIds) {
523
503
  }
524
504
  attributes.id.value = result;
525
505
  }
526
-
527
506
  function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
528
507
  var _featureIndex$metadat, _featureIndex$metadat2;
529
508
  return featureIndex === null || featureIndex === void 0 ? void 0 : (_featureIndex$metadat = featureIndex.metadata) === null || _featureIndex$metadat === void 0 ? void 0 : (_featureIndex$metadat2 = _featureIndex$metadat['i3s-feature-ids']) === null || _featureIndex$metadat2 === void 0 ? void 0 : _featureIndex$metadat2.intArray;