@loaders.gl/tiles 3.1.3 → 4.0.0-alpha.5
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 +2 -2
- package/dist/bundle.js.map +1 -0
- package/dist/constants.js +26 -29
- package/dist/constants.js.map +1 -0
- package/dist/dist.min.js +45 -264
- package/dist/index.js +10 -28
- package/dist/index.js.map +1 -0
- package/dist/tileset/helpers/3d-tiles-options.js +5 -8
- package/dist/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/tileset/helpers/bounding-volume.js +70 -159
- package/dist/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/tileset/helpers/frame-state.js +48 -67
- package/dist/tileset/helpers/frame-state.js.map +1 -0
- package/dist/tileset/helpers/i3s-lod.js +64 -80
- package/dist/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/tileset/helpers/tiles-3d-lod.js +100 -111
- package/dist/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/tileset/helpers/transform-utils.js +56 -50
- package/dist/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/tileset/helpers/zoom.js +30 -36
- package/dist/tileset/helpers/zoom.js.map +1 -0
- package/dist/tileset/tile-3d.js +533 -551
- package/dist/tileset/tile-3d.js.map +1 -0
- package/dist/tileset/tileset-3d.js +649 -576
- package/dist/tileset/tileset-3d.js.map +1 -0
- package/dist/tileset/tileset-cache.js +71 -71
- package/dist/tileset/tileset-cache.js.map +1 -0
- package/dist/tileset/traversers/i3s-tile-manager.js +40 -31
- package/dist/tileset/traversers/i3s-tile-manager.js.map +1 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.js +76 -81
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +1 -0
- package/dist/tileset/traversers/tileset-3d-traverser.js +49 -51
- package/dist/tileset/traversers/tileset-3d-traverser.js.map +1 -0
- package/dist/tileset/traversers/tileset-traverser.js +276 -274
- package/dist/tileset/traversers/tileset-traverser.js.map +1 -0
- package/dist/utils/doubly-linked-list-node.js +15 -16
- package/dist/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/utils/doubly-linked-list.js +75 -94
- package/dist/utils/doubly-linked-list.js.map +1 -0
- package/dist/utils/managed-array.js +109 -143
- package/dist/utils/managed-array.js.map +1 -0
- package/package.json +7 -7
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/constants.js +0 -44
- package/dist/es5/constants.js.map +0 -1
- package/dist/es5/index.js +0 -104
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js +0 -13
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/es5/tileset/helpers/bounding-volume.js +0 -114
- package/dist/es5/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/es5/tileset/helpers/frame-state.js +0 -65
- package/dist/es5/tileset/helpers/frame-state.js.map +0 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +0 -86
- package/dist/es5/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +0 -119
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/transform-utils.js +0 -65
- package/dist/es5/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/es5/tileset/helpers/zoom.js +0 -43
- package/dist/es5/tileset/helpers/zoom.js.map +0 -1
- package/dist/es5/tileset/tile-3d.js +0 -605
- package/dist/es5/tileset/tile-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-3d.js +0 -838
- package/dist/es5/tileset/tileset-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-cache.js +0 -101
- package/dist/es5/tileset/tileset-cache.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +0 -69
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +0 -185
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +0 -94
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +0 -377
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list-node.js +0 -25
- package/dist/es5/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list.js +0 -104
- package/dist/es5/utils/doubly-linked-list.js.map +0 -1
- package/dist/es5/utils/managed-array.js +0 -147
- package/dist/es5/utils/managed-array.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/constants.js +0 -32
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js +0 -10
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js +0 -6
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/esm/tileset/helpers/bounding-volume.js +0 -88
- package/dist/esm/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/esm/tileset/helpers/frame-state.js +0 -51
- package/dist/esm/tileset/helpers/frame-state.js.map +0 -1
- package/dist/esm/tileset/helpers/i3s-lod.js +0 -67
- package/dist/esm/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/tiles-3d-lod.js +0 -105
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/transform-utils.js +0 -58
- package/dist/esm/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/esm/tileset/helpers/zoom.js +0 -36
- package/dist/esm/tileset/helpers/zoom.js.map +0 -1
- package/dist/esm/tileset/tile-3d.js +0 -537
- package/dist/esm/tileset/tile-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-3d.js +0 -674
- package/dist/esm/tileset/tileset-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-cache.js +0 -79
- package/dist/esm/tileset/tileset-cache.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tile-manager.js +0 -45
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js +0 -80
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js +0 -53
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js +0 -296
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list-node.js +0 -16
- package/dist/esm/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list.js +0 -81
- package/dist/esm/utils/doubly-linked-list.js.map +0 -1
- package/dist/esm/utils/managed-array.js +0 -117
- package/dist/esm/utils/managed-array.js.map +0 -1
package/dist/tileset/tile-3d.js
CHANGED
|
@@ -1,555 +1,537 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const tiles_3d_lod_1 = require("./helpers/tiles-3d-lod");
|
|
14
|
-
const i3s_lod_1 = require("./helpers/i3s-lod");
|
|
15
|
-
const _3d_tiles_options_1 = require("./helpers/3d-tiles-options");
|
|
16
|
-
const tileset_traverser_1 = __importDefault(require("./traversers/tileset-traverser"));
|
|
17
|
-
const scratchVector = new core_1.Vector3();
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { Vector3, Matrix4 } from '@math.gl/core';
|
|
3
|
+
import { CullingVolume } from '@math.gl/culling';
|
|
4
|
+
import { load } from '@loaders.gl/core';
|
|
5
|
+
import { TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE } from '../constants';
|
|
6
|
+
import { createBoundingVolume } from './helpers/bounding-volume';
|
|
7
|
+
import { getTiles3DScreenSpaceError } from './helpers/tiles-3d-lod';
|
|
8
|
+
import { getProjectedRadius } from './helpers/i3s-lod';
|
|
9
|
+
import { get3dTilesOptions } from './helpers/3d-tiles-options';
|
|
10
|
+
import TilesetTraverser from './traversers/tileset-traverser';
|
|
11
|
+
const scratchVector = new Vector3();
|
|
12
|
+
|
|
18
13
|
function defined(x) {
|
|
19
|
-
|
|
14
|
+
return x !== undefined && x !== null;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
16
|
+
|
|
17
|
+
export default class TileHeader {
|
|
18
|
+
constructor(tileset, header, parentHeader, extendedId = '') {
|
|
19
|
+
_defineProperty(this, "tileset", void 0);
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "header", void 0);
|
|
22
|
+
|
|
23
|
+
_defineProperty(this, "id", void 0);
|
|
24
|
+
|
|
25
|
+
_defineProperty(this, "url", void 0);
|
|
26
|
+
|
|
27
|
+
_defineProperty(this, "parent", void 0);
|
|
28
|
+
|
|
29
|
+
_defineProperty(this, "refine", void 0);
|
|
30
|
+
|
|
31
|
+
_defineProperty(this, "type", void 0);
|
|
32
|
+
|
|
33
|
+
_defineProperty(this, "contentUrl", void 0);
|
|
34
|
+
|
|
35
|
+
_defineProperty(this, "lodMetricType", void 0);
|
|
36
|
+
|
|
37
|
+
_defineProperty(this, "lodMetricValue", void 0);
|
|
38
|
+
|
|
39
|
+
_defineProperty(this, "boundingVolume", void 0);
|
|
40
|
+
|
|
41
|
+
_defineProperty(this, "content", void 0);
|
|
42
|
+
|
|
43
|
+
_defineProperty(this, "contentState", void 0);
|
|
44
|
+
|
|
45
|
+
_defineProperty(this, "gpuMemoryUsageInBytes", void 0);
|
|
46
|
+
|
|
47
|
+
_defineProperty(this, "children", void 0);
|
|
48
|
+
|
|
49
|
+
_defineProperty(this, "depth", void 0);
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "viewportIds", void 0);
|
|
52
|
+
|
|
53
|
+
_defineProperty(this, "transform", void 0);
|
|
54
|
+
|
|
55
|
+
_defineProperty(this, "extensions", void 0);
|
|
56
|
+
|
|
57
|
+
_defineProperty(this, "userData", void 0);
|
|
58
|
+
|
|
59
|
+
_defineProperty(this, "computedTransform", void 0);
|
|
60
|
+
|
|
61
|
+
_defineProperty(this, "hasEmptyContent", void 0);
|
|
62
|
+
|
|
63
|
+
_defineProperty(this, "hasTilesetContent", void 0);
|
|
64
|
+
|
|
65
|
+
_defineProperty(this, "traverser", void 0);
|
|
66
|
+
|
|
67
|
+
_defineProperty(this, "_cacheNode", void 0);
|
|
68
|
+
|
|
69
|
+
_defineProperty(this, "_frameNumber", void 0);
|
|
70
|
+
|
|
71
|
+
_defineProperty(this, "_lodJudge", void 0);
|
|
72
|
+
|
|
73
|
+
_defineProperty(this, "_expireDate", void 0);
|
|
74
|
+
|
|
75
|
+
_defineProperty(this, "_expiredContent", void 0);
|
|
76
|
+
|
|
77
|
+
_defineProperty(this, "_shouldRefine", void 0);
|
|
78
|
+
|
|
79
|
+
_defineProperty(this, "_distanceToCamera", void 0);
|
|
80
|
+
|
|
81
|
+
_defineProperty(this, "_centerZDepth", void 0);
|
|
82
|
+
|
|
83
|
+
_defineProperty(this, "_screenSpaceError", void 0);
|
|
84
|
+
|
|
85
|
+
_defineProperty(this, "_visibilityPlaneMask", void 0);
|
|
86
|
+
|
|
87
|
+
_defineProperty(this, "_visible", void 0);
|
|
88
|
+
|
|
89
|
+
_defineProperty(this, "_inRequestVolume", void 0);
|
|
90
|
+
|
|
91
|
+
_defineProperty(this, "_stackLength", void 0);
|
|
92
|
+
|
|
93
|
+
_defineProperty(this, "_selectionDepth", void 0);
|
|
94
|
+
|
|
95
|
+
_defineProperty(this, "_touchedFrame", void 0);
|
|
96
|
+
|
|
97
|
+
_defineProperty(this, "_visitedFrame", void 0);
|
|
98
|
+
|
|
99
|
+
_defineProperty(this, "_selectedFrame", void 0);
|
|
100
|
+
|
|
101
|
+
_defineProperty(this, "_requestedFrame", void 0);
|
|
102
|
+
|
|
103
|
+
_defineProperty(this, "_priority", void 0);
|
|
104
|
+
|
|
105
|
+
_defineProperty(this, "_contentBoundingVolume", void 0);
|
|
106
|
+
|
|
107
|
+
_defineProperty(this, "_viewerRequestVolume", void 0);
|
|
108
|
+
|
|
109
|
+
_defineProperty(this, "_initialTransform", void 0);
|
|
110
|
+
|
|
111
|
+
this.header = header;
|
|
112
|
+
this.tileset = tileset;
|
|
113
|
+
this.id = extendedId || header.id;
|
|
114
|
+
this.url = header.url;
|
|
115
|
+
this.parent = parentHeader;
|
|
116
|
+
this.refine = this._getRefine(header.refine);
|
|
117
|
+
this.type = header.type;
|
|
118
|
+
this.contentUrl = header.contentUrl;
|
|
119
|
+
this.lodMetricType = 'geometricError';
|
|
120
|
+
this.lodMetricValue = 0;
|
|
121
|
+
this.boundingVolume = null;
|
|
122
|
+
this.content = null;
|
|
123
|
+
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
124
|
+
this.gpuMemoryUsageInBytes = 0;
|
|
125
|
+
this.children = [];
|
|
126
|
+
this.hasEmptyContent = false;
|
|
127
|
+
this.hasTilesetContent = false;
|
|
128
|
+
this.depth = 0;
|
|
129
|
+
this.viewportIds = [];
|
|
130
|
+
this.userData = {};
|
|
131
|
+
this.extensions = null;
|
|
132
|
+
this._priority = 0;
|
|
133
|
+
this._touchedFrame = 0;
|
|
134
|
+
this._visitedFrame = 0;
|
|
135
|
+
this._selectedFrame = 0;
|
|
136
|
+
this._requestedFrame = 0;
|
|
137
|
+
this._screenSpaceError = 0;
|
|
138
|
+
this._cacheNode = null;
|
|
139
|
+
this._frameNumber = null;
|
|
140
|
+
this._cacheNode = null;
|
|
141
|
+
this.traverser = new TilesetTraverser({});
|
|
142
|
+
this._shouldRefine = false;
|
|
143
|
+
this._distanceToCamera = 0;
|
|
144
|
+
this._centerZDepth = 0;
|
|
145
|
+
this._visible = undefined;
|
|
146
|
+
this._inRequestVolume = false;
|
|
147
|
+
this._stackLength = 0;
|
|
148
|
+
this._selectionDepth = 0;
|
|
149
|
+
this._initialTransform = new Matrix4();
|
|
150
|
+
this.transform = new Matrix4();
|
|
151
|
+
|
|
152
|
+
this._initializeLodMetric(header);
|
|
153
|
+
|
|
154
|
+
this._initializeTransforms(header);
|
|
155
|
+
|
|
156
|
+
this._initializeBoundingVolumes(header);
|
|
157
|
+
|
|
158
|
+
this._initializeContent(header);
|
|
159
|
+
|
|
160
|
+
this._initializeRenderingState(header);
|
|
161
|
+
|
|
162
|
+
this._lodJudge = null;
|
|
163
|
+
this._expireDate = null;
|
|
164
|
+
this._expiredContent = null;
|
|
165
|
+
Object.seal(this);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
destroy() {
|
|
169
|
+
this.header = null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
isDestroyed() {
|
|
173
|
+
return this.header === null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get selected() {
|
|
177
|
+
return this._selectedFrame === this.tileset._frameNumber;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
get isVisible() {
|
|
181
|
+
return this._visible;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
get isVisibleAndInRequestVolume() {
|
|
185
|
+
return this._visible && this._inRequestVolume;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get hasRenderContent() {
|
|
189
|
+
return !this.hasEmptyContent && !this.hasTilesetContent;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
get hasChildren() {
|
|
193
|
+
return this.children.length > 0 || this.header.children && this.header.children.length > 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
get contentReady() {
|
|
197
|
+
return this.contentState === TILE_CONTENT_STATE.READY || this.hasEmptyContent;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
get contentAvailable() {
|
|
201
|
+
return Boolean(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
get hasUnloadedContent() {
|
|
205
|
+
return this.hasRenderContent && this.contentUnloaded;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
get contentUnloaded() {
|
|
209
|
+
return this.contentState === TILE_CONTENT_STATE.UNLOADED;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
get contentExpired() {
|
|
213
|
+
return this.contentState === TILE_CONTENT_STATE.EXPIRED;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
get contentFailed() {
|
|
217
|
+
return this.contentState === TILE_CONTENT_STATE.FAILED;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
getScreenSpaceError(frameState, useParentLodMetric) {
|
|
221
|
+
switch (this.tileset.type) {
|
|
222
|
+
case TILESET_TYPE.I3S:
|
|
223
|
+
return getProjectedRadius(this, frameState);
|
|
224
|
+
|
|
225
|
+
case TILESET_TYPE.TILES3D:
|
|
226
|
+
return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);
|
|
227
|
+
|
|
228
|
+
default:
|
|
229
|
+
throw new Error('Unsupported tileset type');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_getPriority() {
|
|
234
|
+
const traverser = this.tileset._traverser;
|
|
235
|
+
const {
|
|
236
|
+
skipLevelOfDetail
|
|
237
|
+
} = traverser.options;
|
|
238
|
+
const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;
|
|
239
|
+
|
|
240
|
+
if (maySkipTile && !this.isVisible && this._visible !== undefined) {
|
|
241
|
+
return -1;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (this.tileset._frameNumber - this._touchedFrame >= 1) {
|
|
245
|
+
return -1;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (this.contentState === TILE_CONTENT_STATE.UNLOADED) {
|
|
249
|
+
return -1;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const parent = this.parent;
|
|
253
|
+
const useParentScreenSpaceError = parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);
|
|
254
|
+
const screenSpaceError = useParentScreenSpaceError ? parent._screenSpaceError : this._screenSpaceError;
|
|
255
|
+
const rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;
|
|
256
|
+
return Math.max(rootScreenSpaceError - screenSpaceError, 0);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
async loadContent() {
|
|
260
|
+
if (this.hasEmptyContent) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (this.content) {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const expired = this.contentExpired;
|
|
269
|
+
|
|
270
|
+
if (expired) {
|
|
271
|
+
this._expireDate = null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
this.contentState = TILE_CONTENT_STATE.LOADING;
|
|
275
|
+
const requestToken = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));
|
|
276
|
+
|
|
277
|
+
if (!requestToken) {
|
|
278
|
+
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
try {
|
|
283
|
+
const contentUrl = this.tileset.getTileUrl(this.contentUrl);
|
|
284
|
+
const loader = this.tileset.loader;
|
|
285
|
+
const options = { ...this.tileset.loadOptions,
|
|
286
|
+
[loader.id]: { ...this.tileset.loadOptions[loader.id],
|
|
287
|
+
isTileset: this.type === 'json',
|
|
288
|
+
...this._getLoaderSpecificOptions(loader.id)
|
|
196
289
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
: tileset.modelMatrix.clone();
|
|
444
|
-
this.computedTransform = new core_1.Matrix4(parentTransform).multiplyRight(this.transform);
|
|
445
|
-
const parentInitialTransform = parent && parent._initialTransform ? parent._initialTransform.clone() : new core_1.Matrix4();
|
|
446
|
-
this._initialTransform = new core_1.Matrix4(parentInitialTransform).multiplyRight(this.transform);
|
|
447
|
-
}
|
|
448
|
-
_initializeBoundingVolumes(tileHeader) {
|
|
449
|
-
this._contentBoundingVolume = null;
|
|
450
|
-
this._viewerRequestVolume = null;
|
|
451
|
-
this._updateBoundingVolume(tileHeader);
|
|
452
|
-
}
|
|
453
|
-
_initializeContent(tileHeader) {
|
|
454
|
-
// Empty tile by default
|
|
455
|
-
this.content = { _tileset: this.tileset, _tile: this };
|
|
456
|
-
this.hasEmptyContent = true;
|
|
457
|
-
this.contentState = constants_1.TILE_CONTENT_STATE.UNLOADED;
|
|
458
|
-
// When `true`, the tile's content points to an external tileset.
|
|
459
|
-
// This is `false` until the tile's content is loaded.
|
|
460
|
-
this.hasTilesetContent = false;
|
|
461
|
-
if (tileHeader.contentUrl) {
|
|
462
|
-
this.content = null;
|
|
463
|
-
this.hasEmptyContent = false;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
// TODO - remove anything not related to basic visibility detection
|
|
467
|
-
_initializeRenderingState(header) {
|
|
468
|
-
this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);
|
|
469
|
-
this._shouldRefine = false;
|
|
470
|
-
// Members this are updated every frame for tree traversal and rendering optimizations:
|
|
471
|
-
this._distanceToCamera = 0;
|
|
472
|
-
this._centerZDepth = 0;
|
|
473
|
-
this._screenSpaceError = 0;
|
|
474
|
-
this._visibilityPlaneMask = culling_1.CullingVolume.MASK_INDETERMINATE;
|
|
475
|
-
this._visible = undefined;
|
|
476
|
-
this._inRequestVolume = false;
|
|
477
|
-
this._stackLength = 0;
|
|
478
|
-
this._selectionDepth = 0;
|
|
479
|
-
this._frameNumber = 0;
|
|
480
|
-
this._touchedFrame = 0;
|
|
481
|
-
this._visitedFrame = 0;
|
|
482
|
-
this._selectedFrame = 0;
|
|
483
|
-
this._requestedFrame = 0;
|
|
484
|
-
this._priority = 0.0;
|
|
485
|
-
}
|
|
486
|
-
_getRefine(refine) {
|
|
487
|
-
// Inherit from parent tile if omitted.
|
|
488
|
-
return refine || (this.parent && this.parent.refine) || constants_1.TILE_REFINEMENT.REPLACE;
|
|
489
|
-
}
|
|
490
|
-
_isTileset() {
|
|
491
|
-
return this.contentUrl.indexOf('.json') !== -1;
|
|
492
|
-
}
|
|
493
|
-
_onContentLoaded() {
|
|
494
|
-
// Vector and Geometry tile rendering do not support the skip LOD optimization.
|
|
495
|
-
switch (this.content && this.content.type) {
|
|
496
|
-
case 'vctr':
|
|
497
|
-
case 'geom':
|
|
498
|
-
// @ts-ignore
|
|
499
|
-
this.tileset._traverser.disableSkipLevelOfDetail = true;
|
|
500
|
-
break;
|
|
501
|
-
default:
|
|
502
|
-
}
|
|
503
|
-
// The content may be tileset json
|
|
504
|
-
if (this._isTileset()) {
|
|
505
|
-
this.hasTilesetContent = true;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
_updateBoundingVolume(header) {
|
|
509
|
-
// Update the bounding volumes
|
|
510
|
-
this.boundingVolume = (0, bounding_volume_1.createBoundingVolume)(header.boundingVolume, this.computedTransform, this.boundingVolume);
|
|
511
|
-
const content = header.content;
|
|
512
|
-
if (!content) {
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
// TODO Cesium specific
|
|
516
|
-
// Non-leaf tiles may have a content bounding-volume, which is a tight-fit bounding volume
|
|
517
|
-
// around only the features in the tile. This box is useful for culling for rendering,
|
|
518
|
-
// but not for culling for traversing the tree since it does not guarantee spatial coherence, i.e.,
|
|
519
|
-
// since it only bounds features in the tile, not the entire tile, children may be
|
|
520
|
-
// outside of this box.
|
|
521
|
-
if (content.boundingVolume) {
|
|
522
|
-
this._contentBoundingVolume = (0, bounding_volume_1.createBoundingVolume)(content.boundingVolume, this.computedTransform, this._contentBoundingVolume);
|
|
523
|
-
}
|
|
524
|
-
if (header.viewerRequestVolume) {
|
|
525
|
-
this._viewerRequestVolume = (0, bounding_volume_1.createBoundingVolume)(header.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
// Update the tile's transform. The transform is applied to the tile's bounding volumes.
|
|
529
|
-
_updateTransform(parentTransform = new core_1.Matrix4()) {
|
|
530
|
-
const computedTransform = parentTransform.clone().multiplyRight(this.transform);
|
|
531
|
-
const didTransformChange = !computedTransform.equals(this.computedTransform);
|
|
532
|
-
if (!didTransformChange) {
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
this.computedTransform = computedTransform;
|
|
536
|
-
this._updateBoundingVolume(this.header);
|
|
537
|
-
}
|
|
538
|
-
// Get options which are applicable only for the particular loader
|
|
539
|
-
_getLoaderSpecificOptions(loaderId) {
|
|
540
|
-
switch (loaderId) {
|
|
541
|
-
case 'i3s':
|
|
542
|
-
return {
|
|
543
|
-
...this.tileset.options.i3s,
|
|
544
|
-
tile: this.header,
|
|
545
|
-
tileset: this.tileset.tileset,
|
|
546
|
-
isTileHeader: false
|
|
547
|
-
};
|
|
548
|
-
case '3d-tiles':
|
|
549
|
-
case 'cesium-ion':
|
|
550
|
-
default:
|
|
551
|
-
return (0, _3d_tiles_options_1.get3dTilesOptions)(this.tileset.tileset);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
290
|
+
};
|
|
291
|
+
this.content = await load(contentUrl, loader, options);
|
|
292
|
+
|
|
293
|
+
if (this.tileset.options.contentLoader) {
|
|
294
|
+
await this.tileset.options.contentLoader(this);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (this._isTileset()) {
|
|
298
|
+
this.tileset._initializeTileHeaders(this.content, this);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
this.contentState = TILE_CONTENT_STATE.READY;
|
|
302
|
+
|
|
303
|
+
this._onContentLoaded();
|
|
304
|
+
|
|
305
|
+
return true;
|
|
306
|
+
} catch (error) {
|
|
307
|
+
this.contentState = TILE_CONTENT_STATE.FAILED;
|
|
308
|
+
throw error;
|
|
309
|
+
} finally {
|
|
310
|
+
requestToken.done();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
unloadContent() {
|
|
315
|
+
if (this.content && this.content.destroy) {
|
|
316
|
+
this.content.destroy();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
this.content = null;
|
|
320
|
+
|
|
321
|
+
if (this.header.content && this.header.content.destroy) {
|
|
322
|
+
this.header.content.destroy();
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
this.header.content = null;
|
|
326
|
+
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
updateVisibility(frameState, viewportIds) {
|
|
331
|
+
if (this._frameNumber === frameState.frameNumber) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const parent = this.parent;
|
|
336
|
+
const parentVisibilityPlaneMask = parent ? parent._visibilityPlaneMask : CullingVolume.MASK_INDETERMINATE;
|
|
337
|
+
|
|
338
|
+
if (this.tileset._traverser.options.updateTransforms) {
|
|
339
|
+
const parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;
|
|
340
|
+
|
|
341
|
+
this._updateTransform(parentTransform);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
this._distanceToCamera = this.distanceToTile(frameState);
|
|
345
|
+
this._screenSpaceError = this.getScreenSpaceError(frameState, false);
|
|
346
|
+
this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask);
|
|
347
|
+
this._visible = this._visibilityPlaneMask !== CullingVolume.MASK_OUTSIDE;
|
|
348
|
+
this._inRequestVolume = this.insideViewerRequestVolume(frameState);
|
|
349
|
+
this._frameNumber = frameState.frameNumber;
|
|
350
|
+
this.viewportIds = viewportIds;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
visibility(frameState, parentVisibilityPlaneMask) {
|
|
354
|
+
const {
|
|
355
|
+
cullingVolume
|
|
356
|
+
} = frameState;
|
|
357
|
+
const {
|
|
358
|
+
boundingVolume
|
|
359
|
+
} = this;
|
|
360
|
+
return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
contentVisibility() {
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
distanceToTile(frameState) {
|
|
368
|
+
const boundingVolume = this.boundingVolume;
|
|
369
|
+
return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
cameraSpaceZDepth({
|
|
373
|
+
camera
|
|
374
|
+
}) {
|
|
375
|
+
const boundingVolume = this.boundingVolume;
|
|
376
|
+
scratchVector.subVectors(boundingVolume.center, camera.position);
|
|
377
|
+
return camera.direction.dot(scratchVector);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
insideViewerRequestVolume(frameState) {
|
|
381
|
+
const viewerRequestVolume = this._viewerRequestVolume;
|
|
382
|
+
return !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
updateExpiration() {
|
|
386
|
+
if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {
|
|
387
|
+
const now = Date.now();
|
|
388
|
+
|
|
389
|
+
if (Date.lessThan(this._expireDate, now)) {
|
|
390
|
+
this.contentState = TILE_CONTENT_STATE.EXPIRED;
|
|
391
|
+
this._expiredContent = this.content;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
get extras() {
|
|
397
|
+
return this.header.extras;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
_initializeLodMetric(header) {
|
|
401
|
+
if ('lodMetricType' in header) {
|
|
402
|
+
this.lodMetricType = header.lodMetricType;
|
|
403
|
+
} else {
|
|
404
|
+
this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType;
|
|
405
|
+
console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType");
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if ('lodMetricValue' in header) {
|
|
409
|
+
this.lodMetricValue = header.lodMetricValue;
|
|
410
|
+
} else {
|
|
411
|
+
this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue;
|
|
412
|
+
console.warn('3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue');
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
_initializeTransforms(tileHeader) {
|
|
417
|
+
this.transform = tileHeader.transform ? new Matrix4(tileHeader.transform) : new Matrix4();
|
|
418
|
+
const parent = this.parent;
|
|
419
|
+
const tileset = this.tileset;
|
|
420
|
+
const parentTransform = parent && parent.computedTransform ? parent.computedTransform.clone() : tileset.modelMatrix.clone();
|
|
421
|
+
this.computedTransform = new Matrix4(parentTransform).multiplyRight(this.transform);
|
|
422
|
+
const parentInitialTransform = parent && parent._initialTransform ? parent._initialTransform.clone() : new Matrix4();
|
|
423
|
+
this._initialTransform = new Matrix4(parentInitialTransform).multiplyRight(this.transform);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
_initializeBoundingVolumes(tileHeader) {
|
|
427
|
+
this._contentBoundingVolume = null;
|
|
428
|
+
this._viewerRequestVolume = null;
|
|
429
|
+
|
|
430
|
+
this._updateBoundingVolume(tileHeader);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
_initializeContent(tileHeader) {
|
|
434
|
+
this.content = {
|
|
435
|
+
_tileset: this.tileset,
|
|
436
|
+
_tile: this
|
|
437
|
+
};
|
|
438
|
+
this.hasEmptyContent = true;
|
|
439
|
+
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
440
|
+
this.hasTilesetContent = false;
|
|
441
|
+
|
|
442
|
+
if (tileHeader.contentUrl) {
|
|
443
|
+
this.content = null;
|
|
444
|
+
this.hasEmptyContent = false;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
_initializeRenderingState(header) {
|
|
449
|
+
this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);
|
|
450
|
+
this._shouldRefine = false;
|
|
451
|
+
this._distanceToCamera = 0;
|
|
452
|
+
this._centerZDepth = 0;
|
|
453
|
+
this._screenSpaceError = 0;
|
|
454
|
+
this._visibilityPlaneMask = CullingVolume.MASK_INDETERMINATE;
|
|
455
|
+
this._visible = undefined;
|
|
456
|
+
this._inRequestVolume = false;
|
|
457
|
+
this._stackLength = 0;
|
|
458
|
+
this._selectionDepth = 0;
|
|
459
|
+
this._frameNumber = 0;
|
|
460
|
+
this._touchedFrame = 0;
|
|
461
|
+
this._visitedFrame = 0;
|
|
462
|
+
this._selectedFrame = 0;
|
|
463
|
+
this._requestedFrame = 0;
|
|
464
|
+
this._priority = 0.0;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
_getRefine(refine) {
|
|
468
|
+
return refine || this.parent && this.parent.refine || TILE_REFINEMENT.REPLACE;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
_isTileset() {
|
|
472
|
+
return this.contentUrl.indexOf('.json') !== -1;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
_onContentLoaded() {
|
|
476
|
+
switch (this.content && this.content.type) {
|
|
477
|
+
case 'vctr':
|
|
478
|
+
case 'geom':
|
|
479
|
+
this.tileset._traverser.disableSkipLevelOfDetail = true;
|
|
480
|
+
break;
|
|
481
|
+
|
|
482
|
+
default:
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (this._isTileset()) {
|
|
486
|
+
this.hasTilesetContent = true;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
_updateBoundingVolume(header) {
|
|
491
|
+
this.boundingVolume = createBoundingVolume(header.boundingVolume, this.computedTransform, this.boundingVolume);
|
|
492
|
+
const content = header.content;
|
|
493
|
+
|
|
494
|
+
if (!content) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (content.boundingVolume) {
|
|
499
|
+
this._contentBoundingVolume = createBoundingVolume(content.boundingVolume, this.computedTransform, this._contentBoundingVolume);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (header.viewerRequestVolume) {
|
|
503
|
+
this._viewerRequestVolume = createBoundingVolume(header.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
_updateTransform(parentTransform = new Matrix4()) {
|
|
508
|
+
const computedTransform = parentTransform.clone().multiplyRight(this.transform);
|
|
509
|
+
const didTransformChange = !computedTransform.equals(this.computedTransform);
|
|
510
|
+
|
|
511
|
+
if (!didTransformChange) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
this.computedTransform = computedTransform;
|
|
516
|
+
|
|
517
|
+
this._updateBoundingVolume(this.header);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
_getLoaderSpecificOptions(loaderId) {
|
|
521
|
+
switch (loaderId) {
|
|
522
|
+
case 'i3s':
|
|
523
|
+
return { ...this.tileset.options.i3s,
|
|
524
|
+
tile: this.header,
|
|
525
|
+
tileset: this.tileset.tileset,
|
|
526
|
+
isTileHeader: false
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
case '3d-tiles':
|
|
530
|
+
case 'cesium-ion':
|
|
531
|
+
default:
|
|
532
|
+
return get3dTilesOptions(this.tileset.tileset);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
554
536
|
}
|
|
555
|
-
|
|
537
|
+
//# sourceMappingURL=tile-3d.js.map
|