@loaders.gl/tiles 3.1.0-beta.5 → 3.1.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/bundle.js +5 -8136
- package/dist/dist.min.js +8423 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js +6 -6
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/index.js +13 -13
- package/dist/es5/tileset/helpers/bounding-volume.js +37 -25
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/es5/tileset/helpers/frame-state.js +25 -29
- package/dist/es5/tileset/helpers/frame-state.js.map +1 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +44 -42
- package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +47 -51
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/transform-utils.js +11 -17
- package/dist/es5/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/es5/tileset/helpers/zoom.js +15 -17
- package/dist/es5/tileset/helpers/zoom.js.map +1 -1
- package/dist/es5/tileset/tile-3d.js +423 -328
- package/dist/es5/tileset/tile-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-3d.js +563 -381
- package/dist/es5/tileset/tileset-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-cache.js +63 -50
- package/dist/es5/tileset/tileset-cache.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +44 -32
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +143 -53
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +62 -34
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +1 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +282 -209
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +1 -1
- package/dist/es5/utils/doubly-linked-list-node.js +11 -11
- package/dist/es5/utils/doubly-linked-list-node.js.map +1 -1
- package/dist/es5/utils/doubly-linked-list.js +76 -64
- package/dist/es5/utils/doubly-linked-list.js.map +1 -1
- package/dist/es5/utils/managed-array.js +106 -86
- package/dist/es5/utils/managed-array.js.map +1 -1
- package/dist/esm/tileset/helpers/frame-state.js +1 -1
- package/dist/esm/tileset/helpers/frame-state.js.map +1 -1
- package/dist/esm/tileset/tile-3d.js +3 -0
- package/dist/esm/tileset/tile-3d.js.map +1 -1
- package/dist/tileset/helpers/frame-state.js +1 -1
- package/dist/tileset/tile-3d.d.ts +1 -0
- package/dist/tileset/tile-3d.d.ts.map +1 -1
- package/dist/tileset/tile-3d.js +1 -0
- package/package.json +7 -7
- package/src/tileset/helpers/frame-state.ts +1 -1
- package/src/tileset/tile-3d.ts +2 -0
|
@@ -7,6 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
10
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
19
|
|
|
12
20
|
var _core = require("@math.gl/core");
|
|
@@ -27,14 +35,20 @@ var _dTilesOptions = require("./helpers/3d-tiles-options");
|
|
|
27
35
|
|
|
28
36
|
var _tilesetTraverser = _interopRequireDefault(require("./traversers/tileset-traverser"));
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
var scratchVector = new _core.Vector3();
|
|
31
43
|
|
|
32
44
|
function defined(x) {
|
|
33
45
|
return x !== undefined && x !== null;
|
|
34
46
|
}
|
|
35
47
|
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
var TileHeader = function () {
|
|
49
|
+
function TileHeader(tileset, header, parentHeader) {
|
|
50
|
+
var extendedId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
51
|
+
(0, _classCallCheck2.default)(this, TileHeader);
|
|
38
52
|
(0, _defineProperty2.default)(this, "tileset", void 0);
|
|
39
53
|
(0, _defineProperty2.default)(this, "header", void 0);
|
|
40
54
|
(0, _defineProperty2.default)(this, "id", void 0);
|
|
@@ -53,6 +67,7 @@ class TileHeader {
|
|
|
53
67
|
(0, _defineProperty2.default)(this, "depth", void 0);
|
|
54
68
|
(0, _defineProperty2.default)(this, "viewportIds", void 0);
|
|
55
69
|
(0, _defineProperty2.default)(this, "transform", void 0);
|
|
70
|
+
(0, _defineProperty2.default)(this, "extensions", void 0);
|
|
56
71
|
(0, _defineProperty2.default)(this, "userData", void 0);
|
|
57
72
|
(0, _defineProperty2.default)(this, "computedTransform", void 0);
|
|
58
73
|
(0, _defineProperty2.default)(this, "hasEmptyContent", void 0);
|
|
@@ -100,6 +115,7 @@ class TileHeader {
|
|
|
100
115
|
this.depth = 0;
|
|
101
116
|
this.viewportIds = [];
|
|
102
117
|
this.userData = {};
|
|
118
|
+
this.extensions = null;
|
|
103
119
|
this._priority = 0;
|
|
104
120
|
this._touchedFrame = 0;
|
|
105
121
|
this._visitedFrame = 0;
|
|
@@ -136,375 +152,454 @@ class TileHeader {
|
|
|
136
152
|
Object.seal(this);
|
|
137
153
|
}
|
|
138
154
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
isDestroyed() {
|
|
144
|
-
return this.header === null;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
get selected() {
|
|
148
|
-
return this._selectedFrame === this.tileset._frameNumber;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
get isVisible() {
|
|
152
|
-
return this._visible;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
get isVisibleAndInRequestVolume() {
|
|
156
|
-
return this._visible && this._inRequestVolume;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
get hasRenderContent() {
|
|
160
|
-
return !this.hasEmptyContent && !this.hasTilesetContent;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
get hasChildren() {
|
|
164
|
-
return this.children.length > 0 || this.header.children && this.header.children.length > 0;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
get contentReady() {
|
|
168
|
-
return this.contentState === _constants.TILE_CONTENT_STATE.READY || this.hasEmptyContent;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
get contentAvailable() {
|
|
172
|
-
return Boolean(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
get hasUnloadedContent() {
|
|
176
|
-
return this.hasRenderContent && this.contentUnloaded;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
get contentUnloaded() {
|
|
180
|
-
return this.contentState === _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
get contentExpired() {
|
|
184
|
-
return this.contentState === _constants.TILE_CONTENT_STATE.EXPIRED;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
get contentFailed() {
|
|
188
|
-
return this.contentState === _constants.TILE_CONTENT_STATE.FAILED;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
getScreenSpaceError(frameState, useParentLodMetric) {
|
|
192
|
-
switch (this.tileset.type) {
|
|
193
|
-
case _constants.TILESET_TYPE.I3S:
|
|
194
|
-
return (0, _i3sLod.getProjectedRadius)(this, frameState);
|
|
195
|
-
|
|
196
|
-
case _constants.TILESET_TYPE.TILES3D:
|
|
197
|
-
return (0, _tiles3dLod.getTiles3DScreenSpaceError)(this, frameState, useParentLodMetric);
|
|
198
|
-
|
|
199
|
-
default:
|
|
200
|
-
throw new Error('Unsupported tileset type');
|
|
155
|
+
(0, _createClass2.default)(TileHeader, [{
|
|
156
|
+
key: "destroy",
|
|
157
|
+
value: function destroy() {
|
|
158
|
+
this.header = null;
|
|
201
159
|
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const {
|
|
207
|
-
skipLevelOfDetail
|
|
208
|
-
} = traverser.options;
|
|
209
|
-
const maySkipTile = this.refine === _constants.TILE_REFINEMENT.ADD || skipLevelOfDetail;
|
|
210
|
-
|
|
211
|
-
if (maySkipTile && !this.isVisible && this._visible !== undefined) {
|
|
212
|
-
return -1;
|
|
160
|
+
}, {
|
|
161
|
+
key: "isDestroyed",
|
|
162
|
+
value: function isDestroyed() {
|
|
163
|
+
return this.header === null;
|
|
213
164
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
165
|
+
}, {
|
|
166
|
+
key: "selected",
|
|
167
|
+
get: function get() {
|
|
168
|
+
return this._selectedFrame === this.tileset._frameNumber;
|
|
217
169
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
170
|
+
}, {
|
|
171
|
+
key: "isVisible",
|
|
172
|
+
get: function get() {
|
|
173
|
+
return this._visible;
|
|
221
174
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;
|
|
227
|
-
return Math.max(rootScreenSpaceError - screenSpaceError, 0);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
async loadContent() {
|
|
231
|
-
if (this.hasEmptyContent) {
|
|
232
|
-
return false;
|
|
175
|
+
}, {
|
|
176
|
+
key: "isVisibleAndInRequestVolume",
|
|
177
|
+
get: function get() {
|
|
178
|
+
return this._visible && this._inRequestVolume;
|
|
233
179
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
180
|
+
}, {
|
|
181
|
+
key: "hasRenderContent",
|
|
182
|
+
get: function get() {
|
|
183
|
+
return !this.hasEmptyContent && !this.hasTilesetContent;
|
|
237
184
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this._expireDate = null;
|
|
185
|
+
}, {
|
|
186
|
+
key: "hasChildren",
|
|
187
|
+
get: function get() {
|
|
188
|
+
return this.children.length > 0 || this.header.children && this.header.children.length > 0;
|
|
243
189
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (!requestToken) {
|
|
249
|
-
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
250
|
-
return false;
|
|
190
|
+
}, {
|
|
191
|
+
key: "contentReady",
|
|
192
|
+
get: function get() {
|
|
193
|
+
return this.contentState === _constants.TILE_CONTENT_STATE.READY || this.hasEmptyContent;
|
|
251
194
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const options = { ...this.tileset.loadOptions,
|
|
257
|
-
[loader.id]: { ...this.tileset.loadOptions[loader.id],
|
|
258
|
-
isTileset: this.type === 'json',
|
|
259
|
-
...this._getLoaderSpecificOptions(loader.id)
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
this.content = await (0, _core2.load)(contentUrl, loader, options);
|
|
263
|
-
|
|
264
|
-
if (this.tileset.options.contentLoader) {
|
|
265
|
-
await this.tileset.options.contentLoader(this);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (this._isTileset()) {
|
|
269
|
-
this.tileset._initializeTileHeaders(this.content, this);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
this.contentState = _constants.TILE_CONTENT_STATE.READY;
|
|
273
|
-
|
|
274
|
-
this._onContentLoaded();
|
|
275
|
-
|
|
276
|
-
return true;
|
|
277
|
-
} catch (error) {
|
|
278
|
-
this.contentState = _constants.TILE_CONTENT_STATE.FAILED;
|
|
279
|
-
throw error;
|
|
280
|
-
} finally {
|
|
281
|
-
requestToken.done();
|
|
195
|
+
}, {
|
|
196
|
+
key: "contentAvailable",
|
|
197
|
+
get: function get() {
|
|
198
|
+
return Boolean(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);
|
|
282
199
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
this.content.destroy();
|
|
200
|
+
}, {
|
|
201
|
+
key: "hasUnloadedContent",
|
|
202
|
+
get: function get() {
|
|
203
|
+
return this.hasRenderContent && this.contentUnloaded;
|
|
288
204
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
this.header.content.destroy();
|
|
205
|
+
}, {
|
|
206
|
+
key: "contentUnloaded",
|
|
207
|
+
get: function get() {
|
|
208
|
+
return this.contentState === _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
294
209
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
updateVisibility(frameState, viewportIds) {
|
|
302
|
-
if (this._frameNumber === frameState.frameNumber) {
|
|
303
|
-
return;
|
|
210
|
+
}, {
|
|
211
|
+
key: "contentExpired",
|
|
212
|
+
get: function get() {
|
|
213
|
+
return this.contentState === _constants.TILE_CONTENT_STATE.EXPIRED;
|
|
304
214
|
}
|
|
215
|
+
}, {
|
|
216
|
+
key: "contentFailed",
|
|
217
|
+
get: function get() {
|
|
218
|
+
return this.contentState === _constants.TILE_CONTENT_STATE.FAILED;
|
|
219
|
+
}
|
|
220
|
+
}, {
|
|
221
|
+
key: "getScreenSpaceError",
|
|
222
|
+
value: function getScreenSpaceError(frameState, useParentLodMetric) {
|
|
223
|
+
switch (this.tileset.type) {
|
|
224
|
+
case _constants.TILESET_TYPE.I3S:
|
|
225
|
+
return (0, _i3sLod.getProjectedRadius)(this, frameState);
|
|
226
|
+
|
|
227
|
+
case _constants.TILESET_TYPE.TILES3D:
|
|
228
|
+
return (0, _tiles3dLod.getTiles3DScreenSpaceError)(this, frameState, useParentLodMetric);
|
|
229
|
+
|
|
230
|
+
default:
|
|
231
|
+
throw new Error('Unsupported tileset type');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}, {
|
|
235
|
+
key: "_getPriority",
|
|
236
|
+
value: function _getPriority() {
|
|
237
|
+
var traverser = this.tileset._traverser;
|
|
238
|
+
var skipLevelOfDetail = traverser.options.skipLevelOfDetail;
|
|
239
|
+
var maySkipTile = this.refine === _constants.TILE_REFINEMENT.ADD || skipLevelOfDetail;
|
|
240
|
+
|
|
241
|
+
if (maySkipTile && !this.isVisible && this._visible !== undefined) {
|
|
242
|
+
return -1;
|
|
243
|
+
}
|
|
305
244
|
|
|
306
|
-
|
|
307
|
-
|
|
245
|
+
if (this.tileset._frameNumber - this._touchedFrame >= 1) {
|
|
246
|
+
return -1;
|
|
247
|
+
}
|
|
308
248
|
|
|
309
|
-
|
|
310
|
-
|
|
249
|
+
if (this.contentState === _constants.TILE_CONTENT_STATE.UNLOADED) {
|
|
250
|
+
return -1;
|
|
251
|
+
}
|
|
311
252
|
|
|
312
|
-
this.
|
|
253
|
+
var parent = this.parent;
|
|
254
|
+
var useParentScreenSpaceError = parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);
|
|
255
|
+
var screenSpaceError = useParentScreenSpaceError ? parent._screenSpaceError : this._screenSpaceError;
|
|
256
|
+
var rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;
|
|
257
|
+
return Math.max(rootScreenSpaceError - screenSpaceError, 0);
|
|
313
258
|
}
|
|
259
|
+
}, {
|
|
260
|
+
key: "loadContent",
|
|
261
|
+
value: function () {
|
|
262
|
+
var _loadContent = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
|
|
263
|
+
var expired, requestToken, contentUrl, loader, options;
|
|
264
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
265
|
+
while (1) {
|
|
266
|
+
switch (_context.prev = _context.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
if (!this.hasEmptyContent) {
|
|
269
|
+
_context.next = 2;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return _context.abrupt("return", false);
|
|
274
|
+
|
|
275
|
+
case 2:
|
|
276
|
+
if (!this.content) {
|
|
277
|
+
_context.next = 4;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return _context.abrupt("return", true);
|
|
282
|
+
|
|
283
|
+
case 4:
|
|
284
|
+
expired = this.contentExpired;
|
|
285
|
+
|
|
286
|
+
if (expired) {
|
|
287
|
+
this._expireDate = null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
this.contentState = _constants.TILE_CONTENT_STATE.LOADING;
|
|
291
|
+
_context.next = 9;
|
|
292
|
+
return this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));
|
|
293
|
+
|
|
294
|
+
case 9:
|
|
295
|
+
requestToken = _context.sent;
|
|
296
|
+
|
|
297
|
+
if (requestToken) {
|
|
298
|
+
_context.next = 13;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
303
|
+
return _context.abrupt("return", false);
|
|
304
|
+
|
|
305
|
+
case 13:
|
|
306
|
+
_context.prev = 13;
|
|
307
|
+
contentUrl = this.tileset.getTileUrl(this.contentUrl);
|
|
308
|
+
loader = this.tileset.loader;
|
|
309
|
+
options = _objectSpread(_objectSpread({}, this.tileset.loadOptions), {}, (0, _defineProperty2.default)({}, loader.id, _objectSpread(_objectSpread({}, this.tileset.loadOptions[loader.id]), {}, {
|
|
310
|
+
isTileset: this.type === 'json'
|
|
311
|
+
}, this._getLoaderSpecificOptions(loader.id))));
|
|
312
|
+
_context.next = 19;
|
|
313
|
+
return (0, _core2.load)(contentUrl, loader, options);
|
|
314
|
+
|
|
315
|
+
case 19:
|
|
316
|
+
this.content = _context.sent;
|
|
317
|
+
|
|
318
|
+
if (!this.tileset.options.contentLoader) {
|
|
319
|
+
_context.next = 23;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
_context.next = 23;
|
|
324
|
+
return this.tileset.options.contentLoader(this);
|
|
325
|
+
|
|
326
|
+
case 23:
|
|
327
|
+
if (this._isTileset()) {
|
|
328
|
+
this.tileset._initializeTileHeaders(this.content, this);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
this.contentState = _constants.TILE_CONTENT_STATE.READY;
|
|
332
|
+
|
|
333
|
+
this._onContentLoaded();
|
|
334
|
+
|
|
335
|
+
return _context.abrupt("return", true);
|
|
336
|
+
|
|
337
|
+
case 29:
|
|
338
|
+
_context.prev = 29;
|
|
339
|
+
_context.t0 = _context["catch"](13);
|
|
340
|
+
this.contentState = _constants.TILE_CONTENT_STATE.FAILED;
|
|
341
|
+
throw _context.t0;
|
|
342
|
+
|
|
343
|
+
case 33:
|
|
344
|
+
_context.prev = 33;
|
|
345
|
+
requestToken.done();
|
|
346
|
+
return _context.finish(33);
|
|
347
|
+
|
|
348
|
+
case 36:
|
|
349
|
+
case "end":
|
|
350
|
+
return _context.stop();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}, _callee, this, [[13, 29, 33, 36]]);
|
|
354
|
+
}));
|
|
355
|
+
|
|
356
|
+
function loadContent() {
|
|
357
|
+
return _loadContent.apply(this, arguments);
|
|
358
|
+
}
|
|
314
359
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
360
|
+
return loadContent;
|
|
361
|
+
}()
|
|
362
|
+
}, {
|
|
363
|
+
key: "unloadContent",
|
|
364
|
+
value: function unloadContent() {
|
|
365
|
+
if (this.content && this.content.destroy) {
|
|
366
|
+
this.content.destroy();
|
|
367
|
+
}
|
|
323
368
|
|
|
324
|
-
|
|
325
|
-
const {
|
|
326
|
-
cullingVolume
|
|
327
|
-
} = frameState;
|
|
328
|
-
const {
|
|
329
|
-
boundingVolume
|
|
330
|
-
} = this;
|
|
331
|
-
return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);
|
|
332
|
-
}
|
|
369
|
+
this.content = null;
|
|
333
370
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
371
|
+
if (this.header.content && this.header.content.destroy) {
|
|
372
|
+
this.header.content.destroy();
|
|
373
|
+
}
|
|
337
374
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
375
|
+
this.header.content = null;
|
|
376
|
+
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
}, {
|
|
380
|
+
key: "updateVisibility",
|
|
381
|
+
value: function updateVisibility(frameState, viewportIds) {
|
|
382
|
+
if (this._frameNumber === frameState.frameNumber) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
342
385
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}) {
|
|
346
|
-
const boundingVolume = this.boundingVolume;
|
|
347
|
-
scratchVector.subVectors(boundingVolume.center, camera.position);
|
|
348
|
-
return camera.direction.dot(scratchVector);
|
|
349
|
-
}
|
|
386
|
+
var parent = this.parent;
|
|
387
|
+
var parentVisibilityPlaneMask = parent ? parent._visibilityPlaneMask : _culling.CullingVolume.MASK_INDETERMINATE;
|
|
350
388
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0;
|
|
354
|
-
}
|
|
389
|
+
if (this.tileset._traverser.options.updateTransforms) {
|
|
390
|
+
var parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;
|
|
355
391
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const now = Date.now();
|
|
392
|
+
this._updateTransform(parentTransform);
|
|
393
|
+
}
|
|
359
394
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
395
|
+
this._distanceToCamera = this.distanceToTile(frameState);
|
|
396
|
+
this._screenSpaceError = this.getScreenSpaceError(frameState, false);
|
|
397
|
+
this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask);
|
|
398
|
+
this._visible = this._visibilityPlaneMask !== _culling.CullingVolume.MASK_OUTSIDE;
|
|
399
|
+
this._inRequestVolume = this.insideViewerRequestVolume(frameState);
|
|
400
|
+
this._frameNumber = frameState.frameNumber;
|
|
401
|
+
this.viewportIds = viewportIds;
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
key: "visibility",
|
|
405
|
+
value: function visibility(frameState, parentVisibilityPlaneMask) {
|
|
406
|
+
var cullingVolume = frameState.cullingVolume;
|
|
407
|
+
var boundingVolume = this.boundingVolume;
|
|
408
|
+
return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);
|
|
409
|
+
}
|
|
410
|
+
}, {
|
|
411
|
+
key: "contentVisibility",
|
|
412
|
+
value: function contentVisibility() {
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "distanceToTile",
|
|
417
|
+
value: function distanceToTile(frameState) {
|
|
418
|
+
var boundingVolume = this.boundingVolume;
|
|
419
|
+
return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));
|
|
420
|
+
}
|
|
421
|
+
}, {
|
|
422
|
+
key: "cameraSpaceZDepth",
|
|
423
|
+
value: function cameraSpaceZDepth(_ref) {
|
|
424
|
+
var camera = _ref.camera;
|
|
425
|
+
var boundingVolume = this.boundingVolume;
|
|
426
|
+
scratchVector.subVectors(boundingVolume.center, camera.position);
|
|
427
|
+
return camera.direction.dot(scratchVector);
|
|
428
|
+
}
|
|
429
|
+
}, {
|
|
430
|
+
key: "insideViewerRequestVolume",
|
|
431
|
+
value: function insideViewerRequestVolume(frameState) {
|
|
432
|
+
var viewerRequestVolume = this._viewerRequestVolume;
|
|
433
|
+
return !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0;
|
|
434
|
+
}
|
|
435
|
+
}, {
|
|
436
|
+
key: "updateExpiration",
|
|
437
|
+
value: function updateExpiration() {
|
|
438
|
+
if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {
|
|
439
|
+
var now = Date.now();
|
|
440
|
+
|
|
441
|
+
if (Date.lessThan(this._expireDate, now)) {
|
|
442
|
+
this.contentState = _constants.TILE_CONTENT_STATE.EXPIRED;
|
|
443
|
+
this._expiredContent = this.content;
|
|
444
|
+
}
|
|
363
445
|
}
|
|
364
446
|
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
_initializeLodMetric(header) {
|
|
372
|
-
if ('lodMetricType' in header) {
|
|
373
|
-
this.lodMetricType = header.lodMetricType;
|
|
374
|
-
} else {
|
|
375
|
-
this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType;
|
|
376
|
-
console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType");
|
|
447
|
+
}, {
|
|
448
|
+
key: "extras",
|
|
449
|
+
get: function get() {
|
|
450
|
+
return this.header.extras;
|
|
377
451
|
}
|
|
452
|
+
}, {
|
|
453
|
+
key: "_initializeLodMetric",
|
|
454
|
+
value: function _initializeLodMetric(header) {
|
|
455
|
+
if ('lodMetricType' in header) {
|
|
456
|
+
this.lodMetricType = header.lodMetricType;
|
|
457
|
+
} else {
|
|
458
|
+
this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType;
|
|
459
|
+
console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType");
|
|
460
|
+
}
|
|
378
461
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
462
|
+
if ('lodMetricValue' in header) {
|
|
463
|
+
this.lodMetricValue = header.lodMetricValue;
|
|
464
|
+
} else {
|
|
465
|
+
this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue;
|
|
466
|
+
console.warn('3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue');
|
|
467
|
+
}
|
|
384
468
|
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
_initializeBoundingVolumes(tileHeader) {
|
|
398
|
-
this._contentBoundingVolume = null;
|
|
399
|
-
this._viewerRequestVolume = null;
|
|
400
|
-
|
|
401
|
-
this._updateBoundingVolume(tileHeader);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
_initializeContent(tileHeader) {
|
|
405
|
-
this.content = {
|
|
406
|
-
_tileset: this.tileset,
|
|
407
|
-
_tile: this
|
|
408
|
-
};
|
|
409
|
-
this.hasEmptyContent = true;
|
|
410
|
-
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
411
|
-
this.hasTilesetContent = false;
|
|
412
|
-
|
|
413
|
-
if (tileHeader.contentUrl) {
|
|
414
|
-
this.content = null;
|
|
415
|
-
this.hasEmptyContent = false;
|
|
469
|
+
}, {
|
|
470
|
+
key: "_initializeTransforms",
|
|
471
|
+
value: function _initializeTransforms(tileHeader) {
|
|
472
|
+
this.transform = tileHeader.transform ? new _core.Matrix4(tileHeader.transform) : new _core.Matrix4();
|
|
473
|
+
var parent = this.parent;
|
|
474
|
+
var tileset = this.tileset;
|
|
475
|
+
var parentTransform = parent && parent.computedTransform ? parent.computedTransform.clone() : tileset.modelMatrix.clone();
|
|
476
|
+
this.computedTransform = new _core.Matrix4(parentTransform).multiplyRight(this.transform);
|
|
477
|
+
var parentInitialTransform = parent && parent._initialTransform ? parent._initialTransform.clone() : new _core.Matrix4();
|
|
478
|
+
this._initialTransform = new _core.Matrix4(parentInitialTransform).multiplyRight(this.transform);
|
|
416
479
|
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
this._distanceToCamera = 0;
|
|
423
|
-
this._centerZDepth = 0;
|
|
424
|
-
this._screenSpaceError = 0;
|
|
425
|
-
this._visibilityPlaneMask = _culling.CullingVolume.MASK_INDETERMINATE;
|
|
426
|
-
this._visible = undefined;
|
|
427
|
-
this._inRequestVolume = false;
|
|
428
|
-
this._stackLength = 0;
|
|
429
|
-
this._selectionDepth = 0;
|
|
430
|
-
this._frameNumber = 0;
|
|
431
|
-
this._touchedFrame = 0;
|
|
432
|
-
this._visitedFrame = 0;
|
|
433
|
-
this._selectedFrame = 0;
|
|
434
|
-
this._requestedFrame = 0;
|
|
435
|
-
this._priority = 0.0;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
_getRefine(refine) {
|
|
439
|
-
return refine || this.parent && this.parent.refine || _constants.TILE_REFINEMENT.REPLACE;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
_isTileset() {
|
|
443
|
-
return this.contentUrl.indexOf('.json') !== -1;
|
|
444
|
-
}
|
|
480
|
+
}, {
|
|
481
|
+
key: "_initializeBoundingVolumes",
|
|
482
|
+
value: function _initializeBoundingVolumes(tileHeader) {
|
|
483
|
+
this._contentBoundingVolume = null;
|
|
484
|
+
this._viewerRequestVolume = null;
|
|
445
485
|
|
|
446
|
-
|
|
447
|
-
switch (this.content && this.content.type) {
|
|
448
|
-
case 'vctr':
|
|
449
|
-
case 'geom':
|
|
450
|
-
this.tileset._traverser.disableSkipLevelOfDetail = true;
|
|
451
|
-
break;
|
|
452
|
-
|
|
453
|
-
default:
|
|
486
|
+
this._updateBoundingVolume(tileHeader);
|
|
454
487
|
}
|
|
488
|
+
}, {
|
|
489
|
+
key: "_initializeContent",
|
|
490
|
+
value: function _initializeContent(tileHeader) {
|
|
491
|
+
this.content = {
|
|
492
|
+
_tileset: this.tileset,
|
|
493
|
+
_tile: this
|
|
494
|
+
};
|
|
495
|
+
this.hasEmptyContent = true;
|
|
496
|
+
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
497
|
+
this.hasTilesetContent = false;
|
|
455
498
|
|
|
456
|
-
|
|
457
|
-
|
|
499
|
+
if (tileHeader.contentUrl) {
|
|
500
|
+
this.content = null;
|
|
501
|
+
this.hasEmptyContent = false;
|
|
502
|
+
}
|
|
458
503
|
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
504
|
+
}, {
|
|
505
|
+
key: "_initializeRenderingState",
|
|
506
|
+
value: function _initializeRenderingState(header) {
|
|
507
|
+
this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);
|
|
508
|
+
this._shouldRefine = false;
|
|
509
|
+
this._distanceToCamera = 0;
|
|
510
|
+
this._centerZDepth = 0;
|
|
511
|
+
this._screenSpaceError = 0;
|
|
512
|
+
this._visibilityPlaneMask = _culling.CullingVolume.MASK_INDETERMINATE;
|
|
513
|
+
this._visible = undefined;
|
|
514
|
+
this._inRequestVolume = false;
|
|
515
|
+
this._stackLength = 0;
|
|
516
|
+
this._selectionDepth = 0;
|
|
517
|
+
this._frameNumber = 0;
|
|
518
|
+
this._touchedFrame = 0;
|
|
519
|
+
this._visitedFrame = 0;
|
|
520
|
+
this._selectedFrame = 0;
|
|
521
|
+
this._requestedFrame = 0;
|
|
522
|
+
this._priority = 0.0;
|
|
467
523
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
524
|
+
}, {
|
|
525
|
+
key: "_getRefine",
|
|
526
|
+
value: function _getRefine(refine) {
|
|
527
|
+
return refine || this.parent && this.parent.refine || _constants.TILE_REFINEMENT.REPLACE;
|
|
471
528
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
529
|
+
}, {
|
|
530
|
+
key: "_isTileset",
|
|
531
|
+
value: function _isTileset() {
|
|
532
|
+
return this.contentUrl.indexOf('.json') !== -1;
|
|
475
533
|
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
534
|
+
}, {
|
|
535
|
+
key: "_onContentLoaded",
|
|
536
|
+
value: function _onContentLoaded() {
|
|
537
|
+
switch (this.content && this.content.type) {
|
|
538
|
+
case 'vctr':
|
|
539
|
+
case 'geom':
|
|
540
|
+
this.tileset._traverser.disableSkipLevelOfDetail = true;
|
|
541
|
+
break;
|
|
542
|
+
|
|
543
|
+
default:
|
|
544
|
+
}
|
|
481
545
|
|
|
482
|
-
|
|
483
|
-
|
|
546
|
+
if (this._isTileset()) {
|
|
547
|
+
this.hasTilesetContent = true;
|
|
548
|
+
}
|
|
484
549
|
}
|
|
550
|
+
}, {
|
|
551
|
+
key: "_updateBoundingVolume",
|
|
552
|
+
value: function _updateBoundingVolume(header) {
|
|
553
|
+
this.boundingVolume = (0, _boundingVolume.createBoundingVolume)(header.boundingVolume, this.computedTransform, this.boundingVolume);
|
|
554
|
+
var content = header.content;
|
|
555
|
+
|
|
556
|
+
if (!content) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
485
559
|
|
|
486
|
-
|
|
560
|
+
if (content.boundingVolume) {
|
|
561
|
+
this._contentBoundingVolume = (0, _boundingVolume.createBoundingVolume)(content.boundingVolume, this.computedTransform, this._contentBoundingVolume);
|
|
562
|
+
}
|
|
487
563
|
|
|
488
|
-
|
|
489
|
-
|
|
564
|
+
if (header.viewerRequestVolume) {
|
|
565
|
+
this._viewerRequestVolume = (0, _boundingVolume.createBoundingVolume)(header.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}, {
|
|
569
|
+
key: "_updateTransform",
|
|
570
|
+
value: function _updateTransform() {
|
|
571
|
+
var parentTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _core.Matrix4();
|
|
572
|
+
var computedTransform = parentTransform.clone().multiplyRight(this.transform);
|
|
573
|
+
var didTransformChange = !computedTransform.equals(this.computedTransform);
|
|
574
|
+
|
|
575
|
+
if (!didTransformChange) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
490
578
|
|
|
491
|
-
|
|
492
|
-
switch (loaderId) {
|
|
493
|
-
case 'i3s':
|
|
494
|
-
return { ...this.tileset.options.i3s,
|
|
495
|
-
tile: this.header,
|
|
496
|
-
tileset: this.tileset.tileset,
|
|
497
|
-
isTileHeader: false
|
|
498
|
-
};
|
|
579
|
+
this.computedTransform = computedTransform;
|
|
499
580
|
|
|
500
|
-
|
|
501
|
-
case 'cesium-ion':
|
|
502
|
-
default:
|
|
503
|
-
return (0, _dTilesOptions.get3dTilesOptions)(this.tileset.tileset);
|
|
581
|
+
this._updateBoundingVolume(this.header);
|
|
504
582
|
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
|
|
583
|
+
}, {
|
|
584
|
+
key: "_getLoaderSpecificOptions",
|
|
585
|
+
value: function _getLoaderSpecificOptions(loaderId) {
|
|
586
|
+
switch (loaderId) {
|
|
587
|
+
case 'i3s':
|
|
588
|
+
return _objectSpread(_objectSpread({}, this.tileset.options.i3s), {}, {
|
|
589
|
+
tile: this.header,
|
|
590
|
+
tileset: this.tileset.tileset,
|
|
591
|
+
isTileHeader: false
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
case '3d-tiles':
|
|
595
|
+
case 'cesium-ion':
|
|
596
|
+
default:
|
|
597
|
+
return (0, _dTilesOptions.get3dTilesOptions)(this.tileset.tileset);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}]);
|
|
601
|
+
return TileHeader;
|
|
602
|
+
}();
|
|
508
603
|
|
|
509
604
|
exports.default = TileHeader;
|
|
510
605
|
//# sourceMappingURL=tile-3d.js.map
|