@loaders.gl/tiles 3.3.0-alpha.4 → 3.3.0-alpha.6
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/dist.min.js +823 -1298
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js +2 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/index.js +26 -36
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js +0 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -1
- package/dist/es5/tileset/helpers/bounding-volume.js +7 -26
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/es5/tileset/helpers/frame-state.js +22 -42
- package/dist/es5/tileset/helpers/frame-state.js.map +1 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +0 -13
- package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +7 -16
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/transform-utils.js +2 -11
- package/dist/es5/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/es5/tileset/helpers/zoom.js +6 -16
- package/dist/es5/tileset/helpers/zoom.js.map +1 -1
- package/dist/es5/tileset/tile-3d.js +95 -96
- package/dist/es5/tileset/tile-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-3d.js +78 -185
- package/dist/es5/tileset/tileset-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-cache.js +1 -14
- package/dist/es5/tileset/tileset-cache.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-pending-tiles-register.js +8 -13
- package/dist/es5/tileset/traversers/i3s-pending-tiles-register.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +20 -24
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +7 -48
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +0 -22
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +1 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +53 -76
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils/doubly-linked-list-node.js +3 -7
- package/dist/es5/utils/doubly-linked-list-node.js.map +1 -1
- package/dist/es5/utils/doubly-linked-list.js +9 -17
- package/dist/es5/utils/doubly-linked-list.js.map +1 -1
- package/dist/es5/utils/managed-array.js +29 -30
- package/dist/es5/utils/managed-array.js.map +1 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/constants.js +3 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -1
- package/dist/esm/tileset/helpers/bounding-volume.js +4 -10
- package/dist/esm/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/esm/tileset/helpers/frame-state.js +16 -16
- package/dist/esm/tileset/helpers/frame-state.js.map +1 -1
- package/dist/esm/tileset/helpers/i3s-lod.js +4 -4
- package/dist/esm/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/esm/tileset/helpers/tiles-3d-lod.js +11 -8
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/esm/tileset/helpers/transform-utils.js +1 -3
- package/dist/esm/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/esm/tileset/helpers/zoom.js +3 -2
- package/dist/esm/tileset/helpers/zoom.js.map +1 -1
- package/dist/esm/tileset/tile-3d.js +31 -107
- package/dist/esm/tileset/tile-3d.js.map +1 -1
- package/dist/esm/tileset/tileset-3d.js +21 -155
- package/dist/esm/tileset/tileset-3d.js.map +1 -1
- package/dist/esm/tileset/tileset-cache.js +2 -18
- package/dist/esm/tileset/tileset-cache.js.map +1 -1
- package/dist/esm/tileset/traversers/i3s-pending-tiles-register.js +0 -5
- package/dist/esm/tileset/traversers/i3s-pending-tiles-register.js.map +1 -1
- package/dist/esm/tileset/traversers/i3s-tile-manager.js +2 -4
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +1 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js +4 -17
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js +2 -9
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js.map +1 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js +18 -57
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/doubly-linked-list-node.js +1 -4
- package/dist/esm/utils/doubly-linked-list-node.js.map +1 -1
- package/dist/esm/utils/doubly-linked-list.js +2 -11
- package/dist/esm/utils/doubly-linked-list.js.map +1 -1
- package/dist/esm/utils/managed-array.js +4 -22
- package/dist/esm/utils/managed-array.js.map +1 -1
- package/dist/tileset/helpers/frame-state.d.ts +4 -4
- package/dist/tileset/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset/helpers/frame-state.js +1 -0
- package/dist/tileset/tileset-3d.d.ts.map +1 -1
- package/dist/types.d.ts +18 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/tileset/helpers/frame-state.ts +6 -5
- package/src/tileset/tileset-3d.ts +2 -2
- package/src/types.ts +19 -10
|
@@ -1,51 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
13
|
var _core = require("@math.gl/core");
|
|
21
|
-
|
|
22
14
|
var _culling = require("@math.gl/culling");
|
|
23
|
-
|
|
24
15
|
var _core2 = require("@loaders.gl/core");
|
|
25
|
-
|
|
26
16
|
var _constants = require("../constants");
|
|
27
|
-
|
|
28
17
|
var _boundingVolume = require("./helpers/bounding-volume");
|
|
29
|
-
|
|
30
18
|
var _tiles3dLod = require("./helpers/tiles-3d-lod");
|
|
31
|
-
|
|
32
19
|
var _i3sLod = require("./helpers/i3s-lod");
|
|
33
|
-
|
|
34
20
|
var _dTilesOptions = require("./helpers/3d-tiles-options");
|
|
35
|
-
|
|
36
21
|
var _tilesetTraverser = _interopRequireDefault(require("./traversers/tileset-traverser"));
|
|
37
|
-
|
|
38
|
-
function
|
|
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
|
-
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
42
24
|
var scratchVector = new _core.Vector3();
|
|
43
|
-
|
|
44
25
|
function defined(x) {
|
|
45
26
|
return x !== undefined && x !== null;
|
|
46
27
|
}
|
|
47
28
|
|
|
48
29
|
var TileHeader = function () {
|
|
30
|
+
|
|
49
31
|
function TileHeader(tileset, header, parentHeader) {
|
|
50
32
|
var extendedId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
51
33
|
(0, _classCallCheck2.default)(this, TileHeader);
|
|
@@ -97,26 +79,34 @@ var TileHeader = function () {
|
|
|
97
79
|
(0, _defineProperty2.default)(this, "_viewerRequestVolume", void 0);
|
|
98
80
|
(0, _defineProperty2.default)(this, "_initialTransform", void 0);
|
|
99
81
|
this.header = header;
|
|
82
|
+
|
|
100
83
|
this.tileset = tileset;
|
|
101
84
|
this.id = extendedId || header.id;
|
|
102
85
|
this.url = header.url;
|
|
86
|
+
|
|
103
87
|
this.parent = parentHeader;
|
|
104
88
|
this.refine = this._getRefine(header.refine);
|
|
105
89
|
this.type = header.type;
|
|
106
90
|
this.contentUrl = header.contentUrl;
|
|
91
|
+
|
|
107
92
|
this.lodMetricType = 'geometricError';
|
|
108
93
|
this.lodMetricValue = 0;
|
|
94
|
+
|
|
109
95
|
this.boundingVolume = null;
|
|
96
|
+
|
|
110
97
|
this.content = null;
|
|
111
98
|
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
112
99
|
this.gpuMemoryUsageInBytes = 0;
|
|
100
|
+
|
|
113
101
|
this.children = [];
|
|
114
102
|
this.hasEmptyContent = false;
|
|
115
103
|
this.hasTilesetContent = false;
|
|
116
104
|
this.depth = 0;
|
|
117
105
|
this.viewportIds = [];
|
|
106
|
+
|
|
118
107
|
this.userData = {};
|
|
119
108
|
this.extensions = null;
|
|
109
|
+
|
|
120
110
|
this._priority = 0;
|
|
121
111
|
this._touchedFrame = 0;
|
|
122
112
|
this._visitedFrame = 0;
|
|
@@ -136,24 +126,19 @@ var TileHeader = function () {
|
|
|
136
126
|
this._selectionDepth = 0;
|
|
137
127
|
this._initialTransform = new _core.Matrix4();
|
|
138
128
|
this.transform = new _core.Matrix4();
|
|
139
|
-
|
|
140
129
|
this._initializeLodMetric(header);
|
|
141
|
-
|
|
142
130
|
this._initializeTransforms(header);
|
|
143
|
-
|
|
144
131
|
this._initializeBoundingVolumes(header);
|
|
145
|
-
|
|
146
132
|
this._initializeContent(header);
|
|
147
|
-
|
|
148
133
|
this._initializeRenderingState(header);
|
|
149
134
|
|
|
150
135
|
this._lodJudge = null;
|
|
136
|
+
|
|
151
137
|
this._expireDate = null;
|
|
152
138
|
this._expiredContent = null;
|
|
153
139
|
this.implicitTiling = null;
|
|
154
140
|
Object.seal(this);
|
|
155
141
|
}
|
|
156
|
-
|
|
157
142
|
(0, _createClass2.default)(TileHeader, [{
|
|
158
143
|
key: "destroy",
|
|
159
144
|
value: function destroy() {
|
|
@@ -179,90 +164,113 @@ var TileHeader = function () {
|
|
|
179
164
|
get: function get() {
|
|
180
165
|
return this._visible && this._inRequestVolume;
|
|
181
166
|
}
|
|
167
|
+
|
|
182
168
|
}, {
|
|
183
169
|
key: "hasRenderContent",
|
|
184
|
-
get:
|
|
170
|
+
get:
|
|
171
|
+
function get() {
|
|
185
172
|
return !this.hasEmptyContent && !this.hasTilesetContent;
|
|
186
173
|
}
|
|
174
|
+
|
|
187
175
|
}, {
|
|
188
176
|
key: "hasChildren",
|
|
189
|
-
get:
|
|
177
|
+
get:
|
|
178
|
+
function get() {
|
|
190
179
|
return this.children.length > 0 || this.header.children && this.header.children.length > 0;
|
|
191
180
|
}
|
|
181
|
+
|
|
192
182
|
}, {
|
|
193
183
|
key: "contentReady",
|
|
194
|
-
get:
|
|
184
|
+
get:
|
|
185
|
+
function get() {
|
|
195
186
|
return this.contentState === _constants.TILE_CONTENT_STATE.READY || this.hasEmptyContent;
|
|
196
187
|
}
|
|
188
|
+
|
|
197
189
|
}, {
|
|
198
190
|
key: "contentAvailable",
|
|
199
|
-
get:
|
|
191
|
+
get:
|
|
192
|
+
function get() {
|
|
200
193
|
return Boolean(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);
|
|
201
194
|
}
|
|
195
|
+
|
|
202
196
|
}, {
|
|
203
197
|
key: "hasUnloadedContent",
|
|
204
|
-
get:
|
|
198
|
+
get:
|
|
199
|
+
function get() {
|
|
205
200
|
return this.hasRenderContent && this.contentUnloaded;
|
|
206
201
|
}
|
|
202
|
+
|
|
207
203
|
}, {
|
|
208
204
|
key: "contentUnloaded",
|
|
209
|
-
get:
|
|
205
|
+
get:
|
|
206
|
+
function get() {
|
|
210
207
|
return this.contentState === _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
211
208
|
}
|
|
209
|
+
|
|
212
210
|
}, {
|
|
213
211
|
key: "contentExpired",
|
|
214
|
-
get:
|
|
212
|
+
get:
|
|
213
|
+
function get() {
|
|
215
214
|
return this.contentState === _constants.TILE_CONTENT_STATE.EXPIRED;
|
|
216
215
|
}
|
|
216
|
+
|
|
217
217
|
}, {
|
|
218
218
|
key: "contentFailed",
|
|
219
|
-
get:
|
|
219
|
+
get:
|
|
220
|
+
function get() {
|
|
220
221
|
return this.contentState === _constants.TILE_CONTENT_STATE.FAILED;
|
|
221
222
|
}
|
|
223
|
+
|
|
222
224
|
}, {
|
|
223
225
|
key: "distanceToCamera",
|
|
224
|
-
get:
|
|
226
|
+
get:
|
|
227
|
+
function get() {
|
|
225
228
|
return this._distanceToCamera;
|
|
226
229
|
}
|
|
230
|
+
|
|
227
231
|
}, {
|
|
228
232
|
key: "screenSpaceError",
|
|
229
|
-
get:
|
|
233
|
+
get:
|
|
234
|
+
function get() {
|
|
230
235
|
return this._screenSpaceError;
|
|
231
236
|
}
|
|
237
|
+
|
|
232
238
|
}, {
|
|
233
239
|
key: "getScreenSpaceError",
|
|
234
|
-
value:
|
|
240
|
+
value:
|
|
241
|
+
function getScreenSpaceError(frameState, useParentLodMetric) {
|
|
235
242
|
switch (this.tileset.type) {
|
|
236
243
|
case _constants.TILESET_TYPE.I3S:
|
|
237
244
|
return (0, _i3sLod.getProjectedRadius)(this, frameState);
|
|
238
|
-
|
|
239
245
|
case _constants.TILESET_TYPE.TILES3D:
|
|
240
246
|
return (0, _tiles3dLod.getTiles3DScreenSpaceError)(this, frameState, useParentLodMetric);
|
|
241
|
-
|
|
242
247
|
default:
|
|
243
248
|
throw new Error('Unsupported tileset type');
|
|
244
249
|
}
|
|
245
250
|
}
|
|
251
|
+
|
|
246
252
|
}, {
|
|
247
253
|
key: "unselect",
|
|
248
|
-
value:
|
|
254
|
+
value:
|
|
255
|
+
function unselect() {
|
|
249
256
|
this._selectedFrame = 0;
|
|
250
257
|
}
|
|
258
|
+
|
|
251
259
|
}, {
|
|
252
260
|
key: "_getPriority",
|
|
253
|
-
value:
|
|
261
|
+
value:
|
|
262
|
+
function _getPriority() {
|
|
254
263
|
var traverser = this.tileset._traverser;
|
|
255
264
|
var skipLevelOfDetail = traverser.options.skipLevelOfDetail;
|
|
265
|
+
|
|
256
266
|
var maySkipTile = this.refine === _constants.TILE_REFINEMENT.ADD || skipLevelOfDetail;
|
|
257
267
|
|
|
258
268
|
if (maySkipTile && !this.isVisible && this._visible !== undefined) {
|
|
259
269
|
return -1;
|
|
260
270
|
}
|
|
261
|
-
|
|
262
271
|
if (this.tileset._frameNumber - this._touchedFrame >= 1) {
|
|
263
272
|
return -1;
|
|
264
273
|
}
|
|
265
|
-
|
|
266
274
|
if (this.contentState === _constants.TILE_CONTENT_STATE.UNLOADED) {
|
|
267
275
|
return -1;
|
|
268
276
|
}
|
|
@@ -271,8 +279,10 @@ var TileHeader = function () {
|
|
|
271
279
|
var useParentScreenSpaceError = parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);
|
|
272
280
|
var screenSpaceError = useParentScreenSpaceError ? parent._screenSpaceError : this._screenSpaceError;
|
|
273
281
|
var rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;
|
|
282
|
+
|
|
274
283
|
return Math.max(rootScreenSpaceError - screenSpaceError, 0);
|
|
275
284
|
}
|
|
285
|
+
|
|
276
286
|
}, {
|
|
277
287
|
key: "loadContent",
|
|
278
288
|
value: function () {
|
|
@@ -286,39 +296,29 @@ var TileHeader = function () {
|
|
|
286
296
|
_context.next = 2;
|
|
287
297
|
break;
|
|
288
298
|
}
|
|
289
|
-
|
|
290
299
|
return _context.abrupt("return", false);
|
|
291
|
-
|
|
292
300
|
case 2:
|
|
293
301
|
if (!this.content) {
|
|
294
302
|
_context.next = 4;
|
|
295
303
|
break;
|
|
296
304
|
}
|
|
297
|
-
|
|
298
305
|
return _context.abrupt("return", true);
|
|
299
|
-
|
|
300
306
|
case 4:
|
|
301
307
|
expired = this.contentExpired;
|
|
302
|
-
|
|
303
308
|
if (expired) {
|
|
304
309
|
this._expireDate = null;
|
|
305
310
|
}
|
|
306
|
-
|
|
307
311
|
this.contentState = _constants.TILE_CONTENT_STATE.LOADING;
|
|
308
312
|
_context.next = 9;
|
|
309
313
|
return this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));
|
|
310
|
-
|
|
311
314
|
case 9:
|
|
312
315
|
requestToken = _context.sent;
|
|
313
|
-
|
|
314
316
|
if (requestToken) {
|
|
315
317
|
_context.next = 13;
|
|
316
318
|
break;
|
|
317
319
|
}
|
|
318
|
-
|
|
319
320
|
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
320
321
|
return _context.abrupt("return", false);
|
|
321
|
-
|
|
322
322
|
case 13:
|
|
323
323
|
_context.prev = 13;
|
|
324
324
|
contentUrl = this.tileset.getTileUrl(this.contentUrl);
|
|
@@ -328,40 +328,30 @@ var TileHeader = function () {
|
|
|
328
328
|
}, this._getLoaderSpecificOptions(loader.id))));
|
|
329
329
|
_context.next = 19;
|
|
330
330
|
return (0, _core2.load)(contentUrl, loader, options);
|
|
331
|
-
|
|
332
331
|
case 19:
|
|
333
332
|
this.content = _context.sent;
|
|
334
|
-
|
|
335
333
|
if (!this.tileset.options.contentLoader) {
|
|
336
334
|
_context.next = 23;
|
|
337
335
|
break;
|
|
338
336
|
}
|
|
339
|
-
|
|
340
337
|
_context.next = 23;
|
|
341
338
|
return this.tileset.options.contentLoader(this);
|
|
342
|
-
|
|
343
339
|
case 23:
|
|
344
340
|
if (this._isTileset()) {
|
|
345
341
|
this.tileset._initializeTileHeaders(this.content, this);
|
|
346
342
|
}
|
|
347
|
-
|
|
348
343
|
this.contentState = _constants.TILE_CONTENT_STATE.READY;
|
|
349
|
-
|
|
350
344
|
this._onContentLoaded();
|
|
351
|
-
|
|
352
345
|
return _context.abrupt("return", true);
|
|
353
|
-
|
|
354
346
|
case 29:
|
|
355
347
|
_context.prev = 29;
|
|
356
348
|
_context.t0 = _context["catch"](13);
|
|
357
349
|
this.contentState = _constants.TILE_CONTENT_STATE.FAILED;
|
|
358
350
|
throw _context.t0;
|
|
359
|
-
|
|
360
351
|
case 33:
|
|
361
352
|
_context.prev = 33;
|
|
362
353
|
requestToken.done();
|
|
363
354
|
return _context.finish(33);
|
|
364
|
-
|
|
365
355
|
case 36:
|
|
366
356
|
case "end":
|
|
367
357
|
return _context.stop();
|
|
@@ -369,46 +359,40 @@ var TileHeader = function () {
|
|
|
369
359
|
}
|
|
370
360
|
}, _callee, this, [[13, 29, 33, 36]]);
|
|
371
361
|
}));
|
|
372
|
-
|
|
373
362
|
function loadContent() {
|
|
374
363
|
return _loadContent.apply(this, arguments);
|
|
375
364
|
}
|
|
376
|
-
|
|
377
365
|
return loadContent;
|
|
378
366
|
}()
|
|
379
367
|
}, {
|
|
380
368
|
key: "unloadContent",
|
|
381
|
-
value:
|
|
369
|
+
value:
|
|
370
|
+
function unloadContent() {
|
|
382
371
|
if (this.content && this.content.destroy) {
|
|
383
372
|
this.content.destroy();
|
|
384
373
|
}
|
|
385
|
-
|
|
386
374
|
this.content = null;
|
|
387
|
-
|
|
388
375
|
if (this.header.content && this.header.content.destroy) {
|
|
389
376
|
this.header.content.destroy();
|
|
390
377
|
}
|
|
391
|
-
|
|
392
378
|
this.header.content = null;
|
|
393
379
|
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
394
380
|
return true;
|
|
395
381
|
}
|
|
382
|
+
|
|
396
383
|
}, {
|
|
397
384
|
key: "updateVisibility",
|
|
398
|
-
value:
|
|
385
|
+
value:
|
|
386
|
+
function updateVisibility(frameState, viewportIds) {
|
|
399
387
|
if (this._frameNumber === frameState.frameNumber) {
|
|
400
388
|
return;
|
|
401
389
|
}
|
|
402
|
-
|
|
403
390
|
var parent = this.parent;
|
|
404
391
|
var parentVisibilityPlaneMask = parent ? parent._visibilityPlaneMask : _culling.CullingVolume.MASK_INDETERMINATE;
|
|
405
|
-
|
|
406
392
|
if (this.tileset._traverser.options.updateTransforms) {
|
|
407
393
|
var parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;
|
|
408
|
-
|
|
409
394
|
this._updateTransform(parentTransform);
|
|
410
395
|
}
|
|
411
|
-
|
|
412
396
|
this._distanceToCamera = this.distanceToTile(frameState);
|
|
413
397
|
this._screenSpaceError = this.getScreenSpaceError(frameState, false);
|
|
414
398
|
this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask);
|
|
@@ -417,44 +401,58 @@ var TileHeader = function () {
|
|
|
417
401
|
this._frameNumber = frameState.frameNumber;
|
|
418
402
|
this.viewportIds = viewportIds;
|
|
419
403
|
}
|
|
404
|
+
|
|
420
405
|
}, {
|
|
421
406
|
key: "visibility",
|
|
422
|
-
value:
|
|
407
|
+
value:
|
|
408
|
+
function visibility(frameState, parentVisibilityPlaneMask) {
|
|
423
409
|
var cullingVolume = frameState.cullingVolume;
|
|
424
410
|
var boundingVolume = this.boundingVolume;
|
|
411
|
+
|
|
425
412
|
return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);
|
|
426
413
|
}
|
|
414
|
+
|
|
427
415
|
}, {
|
|
428
416
|
key: "contentVisibility",
|
|
429
|
-
value:
|
|
417
|
+
value:
|
|
418
|
+
function contentVisibility() {
|
|
430
419
|
return true;
|
|
420
|
+
|
|
431
421
|
}
|
|
422
|
+
|
|
432
423
|
}, {
|
|
433
424
|
key: "distanceToTile",
|
|
434
|
-
value:
|
|
425
|
+
value:
|
|
426
|
+
function distanceToTile(frameState) {
|
|
435
427
|
var boundingVolume = this.boundingVolume;
|
|
436
428
|
return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));
|
|
437
429
|
}
|
|
430
|
+
|
|
438
431
|
}, {
|
|
439
432
|
key: "cameraSpaceZDepth",
|
|
440
|
-
value:
|
|
433
|
+
value:
|
|
434
|
+
function cameraSpaceZDepth(_ref) {
|
|
441
435
|
var camera = _ref.camera;
|
|
442
436
|
var boundingVolume = this.boundingVolume;
|
|
443
437
|
scratchVector.subVectors(boundingVolume.center, camera.position);
|
|
444
438
|
return camera.direction.dot(scratchVector);
|
|
445
439
|
}
|
|
440
|
+
|
|
446
441
|
}, {
|
|
447
442
|
key: "insideViewerRequestVolume",
|
|
448
|
-
value:
|
|
443
|
+
value:
|
|
444
|
+
function insideViewerRequestVolume(frameState) {
|
|
449
445
|
var viewerRequestVolume = this._viewerRequestVolume;
|
|
450
446
|
return !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0;
|
|
451
447
|
}
|
|
448
|
+
|
|
452
449
|
}, {
|
|
453
450
|
key: "updateExpiration",
|
|
454
|
-
value:
|
|
451
|
+
value:
|
|
452
|
+
|
|
453
|
+
function updateExpiration() {
|
|
455
454
|
if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {
|
|
456
455
|
var now = Date.now();
|
|
457
|
-
|
|
458
456
|
if (Date.lessThan(this._expireDate, now)) {
|
|
459
457
|
this.contentState = _constants.TILE_CONTENT_STATE.EXPIRED;
|
|
460
458
|
this._expiredContent = this.content;
|
|
@@ -466,9 +464,12 @@ var TileHeader = function () {
|
|
|
466
464
|
get: function get() {
|
|
467
465
|
return this.header.extras;
|
|
468
466
|
}
|
|
467
|
+
|
|
469
468
|
}, {
|
|
470
469
|
key: "_initializeLodMetric",
|
|
471
|
-
value:
|
|
470
|
+
value:
|
|
471
|
+
|
|
472
|
+
function _initializeLodMetric(header) {
|
|
472
473
|
if ('lodMetricType' in header) {
|
|
473
474
|
this.lodMetricType = header.lodMetricType;
|
|
474
475
|
} else {
|
|
@@ -499,7 +500,6 @@ var TileHeader = function () {
|
|
|
499
500
|
value: function _initializeBoundingVolumes(tileHeader) {
|
|
500
501
|
this._contentBoundingVolume = null;
|
|
501
502
|
this._viewerRequestVolume = null;
|
|
502
|
-
|
|
503
503
|
this._updateBoundingVolume(tileHeader);
|
|
504
504
|
}
|
|
505
505
|
}, {
|
|
@@ -511,18 +511,21 @@ var TileHeader = function () {
|
|
|
511
511
|
};
|
|
512
512
|
this.hasEmptyContent = true;
|
|
513
513
|
this.contentState = _constants.TILE_CONTENT_STATE.UNLOADED;
|
|
514
|
-
this.hasTilesetContent = false;
|
|
515
514
|
|
|
515
|
+
this.hasTilesetContent = false;
|
|
516
516
|
if (tileHeader.contentUrl) {
|
|
517
517
|
this.content = null;
|
|
518
518
|
this.hasEmptyContent = false;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
+
|
|
521
522
|
}, {
|
|
522
523
|
key: "_initializeRenderingState",
|
|
523
|
-
value:
|
|
524
|
+
value:
|
|
525
|
+
function _initializeRenderingState(header) {
|
|
524
526
|
this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);
|
|
525
527
|
this._shouldRefine = false;
|
|
528
|
+
|
|
526
529
|
this._distanceToCamera = 0;
|
|
527
530
|
this._centerZDepth = 0;
|
|
528
531
|
this._screenSpaceError = 0;
|
|
@@ -556,7 +559,6 @@ var TileHeader = function () {
|
|
|
556
559
|
case 'geom':
|
|
557
560
|
this.tileset._traverser.disableSkipLevelOfDetail = true;
|
|
558
561
|
break;
|
|
559
|
-
|
|
560
562
|
default:
|
|
561
563
|
}
|
|
562
564
|
|
|
@@ -569,7 +571,6 @@ var TileHeader = function () {
|
|
|
569
571
|
value: function _updateBoundingVolume(header) {
|
|
570
572
|
this.boundingVolume = (0, _boundingVolume.createBoundingVolume)(header.boundingVolume, this.computedTransform, this.boundingVolume);
|
|
571
573
|
var content = header.content;
|
|
572
|
-
|
|
573
574
|
if (!content) {
|
|
574
575
|
return;
|
|
575
576
|
}
|
|
@@ -577,29 +578,29 @@ var TileHeader = function () {
|
|
|
577
578
|
if (content.boundingVolume) {
|
|
578
579
|
this._contentBoundingVolume = (0, _boundingVolume.createBoundingVolume)(content.boundingVolume, this.computedTransform, this._contentBoundingVolume);
|
|
579
580
|
}
|
|
580
|
-
|
|
581
581
|
if (header.viewerRequestVolume) {
|
|
582
582
|
this._viewerRequestVolume = (0, _boundingVolume.createBoundingVolume)(header.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
+
|
|
585
586
|
}, {
|
|
586
587
|
key: "_updateTransform",
|
|
587
|
-
value:
|
|
588
|
+
value:
|
|
589
|
+
function _updateTransform() {
|
|
588
590
|
var parentTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _core.Matrix4();
|
|
589
591
|
var computedTransform = parentTransform.clone().multiplyRight(this.transform);
|
|
590
592
|
var didTransformChange = !computedTransform.equals(this.computedTransform);
|
|
591
|
-
|
|
592
593
|
if (!didTransformChange) {
|
|
593
594
|
return;
|
|
594
595
|
}
|
|
595
|
-
|
|
596
596
|
this.computedTransform = computedTransform;
|
|
597
|
-
|
|
598
597
|
this._updateBoundingVolume(this.header);
|
|
599
598
|
}
|
|
599
|
+
|
|
600
600
|
}, {
|
|
601
601
|
key: "_getLoaderSpecificOptions",
|
|
602
|
-
value:
|
|
602
|
+
value:
|
|
603
|
+
function _getLoaderSpecificOptions(loaderId) {
|
|
603
604
|
switch (loaderId) {
|
|
604
605
|
case 'i3s':
|
|
605
606
|
return _objectSpread(_objectSpread({}, this.tileset.options.i3s), {}, {
|
|
@@ -619,7 +620,6 @@ var TileHeader = function () {
|
|
|
619
620
|
},
|
|
620
621
|
isTileHeader: false
|
|
621
622
|
});
|
|
622
|
-
|
|
623
623
|
case '3d-tiles':
|
|
624
624
|
case 'cesium-ion':
|
|
625
625
|
default:
|
|
@@ -629,6 +629,5 @@ var TileHeader = function () {
|
|
|
629
629
|
}]);
|
|
630
630
|
return TileHeader;
|
|
631
631
|
}();
|
|
632
|
-
|
|
633
632
|
exports.default = TileHeader;
|
|
634
633
|
//# sourceMappingURL=tile-3d.js.map
|