@loaders.gl/tiles 3.3.1 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +93 -5
- package/dist/es5/tileset/helpers/bounding-volume.js +94 -0
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/es5/tileset/tile-3d.js +11 -0
- package/dist/es5/tileset/tile-3d.js.map +1 -1
- package/dist/esm/tileset/helpers/bounding-volume.js +88 -0
- package/dist/esm/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/esm/tileset/tile-3d.js +9 -1
- package/dist/esm/tileset/tile-3d.js.map +1 -1
- package/dist/tileset/helpers/bounding-volume.d.ts +10 -0
- package/dist/tileset/helpers/bounding-volume.d.ts.map +1 -1
- package/dist/tileset/helpers/bounding-volume.js +117 -1
- package/dist/tileset/tile-3d.d.ts +7 -0
- package/dist/tileset/tile-3d.d.ts.map +1 -1
- package/dist/tileset/tile-3d.js +10 -0
- package/package.json +4 -4
- package/src/tileset/helpers/bounding-volume.ts +136 -0
- package/src/tileset/tile-3d.ts +18 -1
package/dist/dist.min.js
CHANGED
|
@@ -4692,8 +4692,8 @@
|
|
|
4692
4692
|
return this;
|
|
4693
4693
|
}
|
|
4694
4694
|
expand(point) {
|
|
4695
|
-
const
|
|
4696
|
-
const radius =
|
|
4695
|
+
const scratchPoint2 = scratchVector6.from(point);
|
|
4696
|
+
const radius = scratchPoint2.subtract(this.center).magnitude();
|
|
4697
4697
|
if (radius > this.radius) {
|
|
4698
4698
|
this.radius = radius;
|
|
4699
4699
|
}
|
|
@@ -4710,8 +4710,8 @@
|
|
|
4710
4710
|
return d * d;
|
|
4711
4711
|
}
|
|
4712
4712
|
distanceTo(point) {
|
|
4713
|
-
const
|
|
4714
|
-
const delta =
|
|
4713
|
+
const scratchPoint2 = scratchVector6.from(point);
|
|
4714
|
+
const delta = scratchPoint2.subtract(this.center);
|
|
4715
4715
|
return Math.max(0, delta.len() - this.radius);
|
|
4716
4716
|
}
|
|
4717
4717
|
intersectPlane(plane) {
|
|
@@ -6975,6 +6975,22 @@
|
|
|
6975
6975
|
}
|
|
6976
6976
|
throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box");
|
|
6977
6977
|
}
|
|
6978
|
+
function getCartographicBounds(boundingVolumeHeader, boundingVolume) {
|
|
6979
|
+
if (boundingVolumeHeader.box) {
|
|
6980
|
+
return orientedBoundingBoxToCartographicBounds(boundingVolume);
|
|
6981
|
+
}
|
|
6982
|
+
if (boundingVolumeHeader.region) {
|
|
6983
|
+
const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
|
|
6984
|
+
return [
|
|
6985
|
+
[degrees(west), degrees(south), minHeight],
|
|
6986
|
+
[degrees(east), degrees(north), maxHeight]
|
|
6987
|
+
];
|
|
6988
|
+
}
|
|
6989
|
+
if (boundingVolumeHeader.sphere) {
|
|
6990
|
+
return boundingSphereToCartographicBounds(boundingVolume);
|
|
6991
|
+
}
|
|
6992
|
+
throw new Error("Unkown boundingVolume type");
|
|
6993
|
+
}
|
|
6978
6994
|
function createBox(box, transform, result) {
|
|
6979
6995
|
const center = new Vector3(box[0], box[1], box[2]);
|
|
6980
6996
|
transform.transform(center, center);
|
|
@@ -7030,13 +7046,79 @@
|
|
|
7030
7046
|
}
|
|
7031
7047
|
return new BoundingSphere(center, radius);
|
|
7032
7048
|
}
|
|
7033
|
-
|
|
7049
|
+
function orientedBoundingBoxToCartographicBounds(boundingVolume) {
|
|
7050
|
+
const result = emptyCartographicBounds();
|
|
7051
|
+
const { halfAxes } = boundingVolume;
|
|
7052
|
+
const xAxis = new Vector3(halfAxes.getColumn(0));
|
|
7053
|
+
const yAxis = new Vector3(halfAxes.getColumn(1));
|
|
7054
|
+
const zAxis = new Vector3(halfAxes.getColumn(2));
|
|
7055
|
+
for (let x = 0; x < 2; x++) {
|
|
7056
|
+
for (let y = 0; y < 2; y++) {
|
|
7057
|
+
for (let z = 0; z < 2; z++) {
|
|
7058
|
+
scratchPoint.copy(boundingVolume.center);
|
|
7059
|
+
scratchPoint.add(xAxis);
|
|
7060
|
+
scratchPoint.add(yAxis);
|
|
7061
|
+
scratchPoint.add(zAxis);
|
|
7062
|
+
addToCartographicBounds(result, scratchPoint);
|
|
7063
|
+
zAxis.negate();
|
|
7064
|
+
}
|
|
7065
|
+
yAxis.negate();
|
|
7066
|
+
}
|
|
7067
|
+
xAxis.negate();
|
|
7068
|
+
}
|
|
7069
|
+
return result;
|
|
7070
|
+
}
|
|
7071
|
+
function boundingSphereToCartographicBounds(boundingVolume) {
|
|
7072
|
+
const result = emptyCartographicBounds();
|
|
7073
|
+
const { center, radius } = boundingVolume;
|
|
7074
|
+
const point = Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);
|
|
7075
|
+
let zAxis;
|
|
7076
|
+
if (point) {
|
|
7077
|
+
zAxis = Ellipsoid.WGS84.geodeticSurfaceNormal(point);
|
|
7078
|
+
} else {
|
|
7079
|
+
zAxis = new Vector3(0, 0, 1);
|
|
7080
|
+
}
|
|
7081
|
+
let xAxis = new Vector3(zAxis[2], -zAxis[1], 0);
|
|
7082
|
+
if (xAxis.len() > 0) {
|
|
7083
|
+
xAxis.normalize();
|
|
7084
|
+
} else {
|
|
7085
|
+
xAxis = new Vector3(0, 1, 0);
|
|
7086
|
+
}
|
|
7087
|
+
const yAxis = xAxis.clone().cross(zAxis);
|
|
7088
|
+
for (const axis of [xAxis, yAxis, zAxis]) {
|
|
7089
|
+
scratchScale.copy(axis).scale(radius);
|
|
7090
|
+
for (let dir = 0; dir < 2; dir++) {
|
|
7091
|
+
scratchPoint.copy(center);
|
|
7092
|
+
scratchPoint.add(scratchScale);
|
|
7093
|
+
addToCartographicBounds(result, scratchPoint);
|
|
7094
|
+
scratchScale.negate();
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
7097
|
+
return result;
|
|
7098
|
+
}
|
|
7099
|
+
function emptyCartographicBounds() {
|
|
7100
|
+
return [
|
|
7101
|
+
[Infinity, Infinity, Infinity],
|
|
7102
|
+
[-Infinity, -Infinity, -Infinity]
|
|
7103
|
+
];
|
|
7104
|
+
}
|
|
7105
|
+
function addToCartographicBounds(target, cartesian) {
|
|
7106
|
+
Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);
|
|
7107
|
+
target[0][0] = Math.min(target[0][0], scratchPoint[0]);
|
|
7108
|
+
target[0][1] = Math.min(target[0][1], scratchPoint[1]);
|
|
7109
|
+
target[0][2] = Math.min(target[0][2], scratchPoint[2]);
|
|
7110
|
+
target[1][0] = Math.max(target[1][0], scratchPoint[0]);
|
|
7111
|
+
target[1][1] = Math.max(target[1][1], scratchPoint[1]);
|
|
7112
|
+
target[1][2] = Math.max(target[1][2], scratchPoint[2]);
|
|
7113
|
+
}
|
|
7114
|
+
var scratchPoint, scratchScale, scratchNorthWest, scratchSouthEast;
|
|
7034
7115
|
var init_bounding_volume = __esm({
|
|
7035
7116
|
"src/tileset/helpers/bounding-volume.ts"() {
|
|
7036
7117
|
init_esm();
|
|
7037
7118
|
init_esm4();
|
|
7038
7119
|
init_esm2();
|
|
7039
7120
|
init_src2();
|
|
7121
|
+
scratchPoint = new Vector3();
|
|
7040
7122
|
scratchScale = new Vector3();
|
|
7041
7123
|
scratchNorthWest = new Vector3();
|
|
7042
7124
|
scratchSouthEast = new Vector3();
|
|
@@ -7587,6 +7669,12 @@
|
|
|
7587
7669
|
get screenSpaceError() {
|
|
7588
7670
|
return this._screenSpaceError;
|
|
7589
7671
|
}
|
|
7672
|
+
get boundingBox() {
|
|
7673
|
+
if (!this._boundingBox) {
|
|
7674
|
+
this._boundingBox = getCartographicBounds(this.header.boundingVolume, this.boundingVolume);
|
|
7675
|
+
}
|
|
7676
|
+
return this._boundingBox;
|
|
7677
|
+
}
|
|
7590
7678
|
getScreenSpaceError(frameState, useParentLodMetric) {
|
|
7591
7679
|
switch (this.tileset.type) {
|
|
7592
7680
|
case TILESET_TYPE.I3S:
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.createBoundingVolume = createBoundingVolume;
|
|
8
|
+
exports.getCartographicBounds = getCartographicBounds;
|
|
8
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _core = require("@math.gl/core");
|
|
@@ -16,6 +17,7 @@ function defined(x) {
|
|
|
16
17
|
return x !== undefined && x !== null;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
var scratchPoint = new _core.Vector3();
|
|
19
21
|
var scratchScale = new _core.Vector3();
|
|
20
22
|
var scratchNorthWest = new _core.Vector3();
|
|
21
23
|
var scratchSouthEast = new _core.Vector3();
|
|
@@ -46,6 +48,26 @@ function createBoundingVolume(boundingVolumeHeader, transform, result) {
|
|
|
46
48
|
}
|
|
47
49
|
throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');
|
|
48
50
|
}
|
|
51
|
+
|
|
52
|
+
function getCartographicBounds(boundingVolumeHeader, boundingVolume) {
|
|
53
|
+
if (boundingVolumeHeader.box) {
|
|
54
|
+
return orientedBoundingBoxToCartographicBounds(boundingVolume);
|
|
55
|
+
}
|
|
56
|
+
if (boundingVolumeHeader.region) {
|
|
57
|
+
var _boundingVolumeHeader2 = (0, _slicedToArray2.default)(boundingVolumeHeader.region, 6),
|
|
58
|
+
west = _boundingVolumeHeader2[0],
|
|
59
|
+
south = _boundingVolumeHeader2[1],
|
|
60
|
+
east = _boundingVolumeHeader2[2],
|
|
61
|
+
north = _boundingVolumeHeader2[3],
|
|
62
|
+
minHeight = _boundingVolumeHeader2[4],
|
|
63
|
+
maxHeight = _boundingVolumeHeader2[5];
|
|
64
|
+
return [[(0, _core.degrees)(west), (0, _core.degrees)(south), minHeight], [(0, _core.degrees)(east), (0, _core.degrees)(north), maxHeight]];
|
|
65
|
+
}
|
|
66
|
+
if (boundingVolumeHeader.sphere) {
|
|
67
|
+
return boundingSphereToCartographicBounds(boundingVolume);
|
|
68
|
+
}
|
|
69
|
+
throw new Error('Unkown boundingVolume type');
|
|
70
|
+
}
|
|
49
71
|
function createBox(box, transform, result) {
|
|
50
72
|
var center = new _core.Vector3(box[0], box[1], box[2]);
|
|
51
73
|
transform.transform(center, center);
|
|
@@ -92,4 +114,76 @@ function createSphere(sphere, transform, result) {
|
|
|
92
114
|
}
|
|
93
115
|
return new _culling.BoundingSphere(center, radius);
|
|
94
116
|
}
|
|
117
|
+
|
|
118
|
+
function orientedBoundingBoxToCartographicBounds(boundingVolume) {
|
|
119
|
+
var result = emptyCartographicBounds();
|
|
120
|
+
var _ref = boundingVolume,
|
|
121
|
+
halfAxes = _ref.halfAxes;
|
|
122
|
+
var xAxis = new _core.Vector3(halfAxes.getColumn(0));
|
|
123
|
+
var yAxis = new _core.Vector3(halfAxes.getColumn(1));
|
|
124
|
+
var zAxis = new _core.Vector3(halfAxes.getColumn(2));
|
|
125
|
+
|
|
126
|
+
for (var x = 0; x < 2; x++) {
|
|
127
|
+
for (var y = 0; y < 2; y++) {
|
|
128
|
+
for (var z = 0; z < 2; z++) {
|
|
129
|
+
scratchPoint.copy(boundingVolume.center);
|
|
130
|
+
scratchPoint.add(xAxis);
|
|
131
|
+
scratchPoint.add(yAxis);
|
|
132
|
+
scratchPoint.add(zAxis);
|
|
133
|
+
addToCartographicBounds(result, scratchPoint);
|
|
134
|
+
zAxis.negate();
|
|
135
|
+
}
|
|
136
|
+
yAxis.negate();
|
|
137
|
+
}
|
|
138
|
+
xAxis.negate();
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function boundingSphereToCartographicBounds(boundingVolume) {
|
|
144
|
+
var result = emptyCartographicBounds();
|
|
145
|
+
var _ref2 = boundingVolume,
|
|
146
|
+
center = _ref2.center,
|
|
147
|
+
radius = _ref2.radius;
|
|
148
|
+
var point = _geospatial.Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);
|
|
149
|
+
var zAxis;
|
|
150
|
+
if (point) {
|
|
151
|
+
zAxis = _geospatial.Ellipsoid.WGS84.geodeticSurfaceNormal(point);
|
|
152
|
+
} else {
|
|
153
|
+
zAxis = new _core.Vector3(0, 0, 1);
|
|
154
|
+
}
|
|
155
|
+
var xAxis = new _core.Vector3(zAxis[2], -zAxis[1], 0);
|
|
156
|
+
if (xAxis.len() > 0) {
|
|
157
|
+
xAxis.normalize();
|
|
158
|
+
} else {
|
|
159
|
+
xAxis = new _core.Vector3(0, 1, 0);
|
|
160
|
+
}
|
|
161
|
+
var yAxis = xAxis.clone().cross(zAxis);
|
|
162
|
+
|
|
163
|
+
for (var _i = 0, _arr = [xAxis, yAxis, zAxis]; _i < _arr.length; _i++) {
|
|
164
|
+
var axis = _arr[_i];
|
|
165
|
+
scratchScale.copy(axis).scale(radius);
|
|
166
|
+
for (var dir = 0; dir < 2; dir++) {
|
|
167
|
+
scratchPoint.copy(center);
|
|
168
|
+
scratchPoint.add(scratchScale);
|
|
169
|
+
addToCartographicBounds(result, scratchPoint);
|
|
170
|
+
scratchScale.negate();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function emptyCartographicBounds() {
|
|
177
|
+
return [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function addToCartographicBounds(target, cartesian) {
|
|
181
|
+
_geospatial.Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);
|
|
182
|
+
target[0][0] = Math.min(target[0][0], scratchPoint[0]);
|
|
183
|
+
target[0][1] = Math.min(target[0][1], scratchPoint[1]);
|
|
184
|
+
target[0][2] = Math.min(target[0][2], scratchPoint[2]);
|
|
185
|
+
target[1][0] = Math.max(target[1][0], scratchPoint[0]);
|
|
186
|
+
target[1][1] = Math.max(target[1][1], scratchPoint[1]);
|
|
187
|
+
target[1][2] = Math.max(target[1][2], scratchPoint[2]);
|
|
188
|
+
}
|
|
95
189
|
//# sourceMappingURL=bounding-volume.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounding-volume.js","names":["defined","x","undefined","scratchScale","Vector3","scratchNorthWest","scratchSouthEast","createBoundingVolume","boundingVolumeHeader","transform","result","assert","box","createBox","region","west","south","east","north","minHeight","maxHeight","northWest","Ellipsoid","WGS84","cartographicToCartesian","degrees","southEast","centerInCartesian","addVectors","multiplyScalar","radius","subVectors","len","createSphere","Matrix4","sphere","Error","center","origin","length","halfSize","slice","quaternion","Quaternion","fromArray","y","z","transformByQuaternion","scale","toArray","xAxis","transformAsVector","yAxis","zAxis","halfAxes","Matrix3","OrientedBoundingBox","getScale","uniformScale","Math","max","BoundingSphere"],"sources":["../../../../src/tileset/helpers/bounding-volume.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Quaternion, Vector3, Matrix3, Matrix4, degrees} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {assert} from '@loaders.gl/loader-utils';\n\n// const scratchProjectedBoundingSphere = new BoundingSphere();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n// const scratchMatrix = new Matrix3();\nconst scratchScale = new Vector3();\nconst scratchNorthWest = new Vector3();\nconst scratchSouthEast = new Vector3();\n// const scratchRectangle = new Rectangle();\n// const scratchOrientedBoundingBox = new OrientedBoundingBox();\n// const scratchTransform = new Matrix4();\n\n/**\n * Create a bounding volume from the tile's bounding volume header.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {Matrix4} transform The transform to apply to the bounding volume.\n * @param [result] The object onto which to store the result.\n * @returns The modified result parameter or a new TileBoundingVolume instance if none was provided.\n */\nexport function createBoundingVolume(boundingVolumeHeader, transform, result) {\n assert(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');\n\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return createBox(boundingVolumeHeader.box, transform, result);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n const northWest = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(west), degrees(north), minHeight],\n scratchNorthWest\n );\n const southEast = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(east), degrees(south), maxHeight],\n scratchSouthEast\n );\n const centerInCartesian = new Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);\n const radius = new Vector3().subVectors(northWest, southEast).len() / 2.0;\n\n // TODO improve region boundingVolume\n // for now, create a sphere as the boundingVolume instead of box\n return createSphere(\n [centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius],\n new Matrix4()\n );\n }\n\n if (boundingVolumeHeader.sphere) {\n return createSphere(boundingVolumeHeader.sphere, transform, result);\n }\n\n throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');\n}\n\nfunction createBox(box, transform, result) {\n // https://math.gl/modules/culling/docs/api-reference/oriented-bounding-box\n // 1. A half-axes based representation.\n // box: An array of 12 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box.\n // The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length.\n // The next three elements (indices 6, 7, and 8) define the y axis direction and half-length.\n // The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.\n // 2. A half-size-quaternion based representation.\n // box: An array of 10 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box in a right-handed 3-axis (x, y, z) Cartesian coordinate system where the z-axis is up.\n // The next three elements (with indices 3, 4, and 5) define the halfSize.\n // The last four elements (indices 6, 7, 8 and 10) define the quaternion.\n const center = new Vector3(box[0], box[1], box[2]);\n transform.transform(center, center);\n let origin: number[] = [];\n if (box.length === 10) {\n const halfSize = box.slice(3, 6);\n const quaternion = new Quaternion();\n quaternion.fromArray(box, 6);\n const x = new Vector3([1, 0, 0]);\n const y = new Vector3([0, 1, 0]);\n const z = new Vector3([0, 0, 1]);\n x.transformByQuaternion(quaternion);\n x.scale(halfSize[0]);\n y.transformByQuaternion(quaternion);\n y.scale(halfSize[1]);\n z.transformByQuaternion(quaternion);\n z.scale(halfSize[2]);\n origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];\n } else {\n origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];\n }\n const xAxis = transform.transformAsVector(origin.slice(0, 3));\n const yAxis = transform.transformAsVector(origin.slice(3, 6));\n const zAxis = transform.transformAsVector(origin.slice(6, 9));\n const halfAxes = new Matrix3([\n xAxis[0],\n xAxis[1],\n xAxis[2],\n yAxis[0],\n yAxis[1],\n yAxis[2],\n zAxis[0],\n zAxis[1],\n zAxis[2]\n ]);\n\n if (defined(result)) {\n result.center = center;\n result.halfAxes = halfAxes;\n return result;\n }\n\n return new OrientedBoundingBox(center, halfAxes);\n}\n\n/*\nfunction createBoxFromTransformedRegion(region, transform, initialTransform, result) {\n const rectangle = Rectangle.unpack(region, 0, scratchRectangle);\n const minimumHeight = region[4];\n const maximumHeight = region[5];\n\n const orientedBoundingBox = OrientedBoundingBox.fromRectangle(\n rectangle,\n minimumHeight,\n maximumHeight,\n Ellipsoid.WGS84,\n scratchOrientedBoundingBox\n );\n const center = orientedBoundingBox.center;\n const halfAxes = orientedBoundingBox.halfAxes;\n\n // A region bounding volume is not transformed by the transform in the tileset JSON,\n // but may be transformed by additional transforms applied in Cesium.\n // This is why the transform is calculated as the difference between the initial transform and the current transform.\n transform = Matrix4.multiplyTransformation(\n transform,\n Matrix4.inverseTransformation(initialTransform, scratchTransform),\n scratchTransform\n );\n center = Matrix4.multiplyByPoint(transform, center, center);\n const rotationScale = Matrix4.getRotation(transform, scratchMatrix);\n halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);\n\n if (defined(result) && result instanceof TileOrientedBoundingBox) {\n result.update(center, halfAxes);\n return result;\n }\n\n return new TileOrientedBoundingBox(center, halfAxes);\n}\n\nfunction createRegion(region, transform, initialTransform, result) {\n if (!Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)) {\n return createBoxFromTransformedRegion(region, transform, initialTransform, result);\n }\n\n if (defined(result)) {\n return result;\n }\n\n const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);\n\n return new TileBoundingRegion({\n rectangle: rectangleRegion,\n minimumHeight: region[4],\n maximumHeight: region[5]\n });\n}\n*/\n\nfunction createSphere(sphere, transform, result?) {\n // Find the transformed center\n const center = new Vector3(sphere[0], sphere[1], sphere[2]);\n transform.transform(center, center);\n const scale = transform.getScale(scratchScale);\n\n const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);\n const radius = sphere[3] * uniformScale;\n\n if (defined(result)) {\n result.center = center;\n result.radius = radius;\n return result;\n }\n\n return new BoundingSphere(center, radius);\n}\n"],"mappings":";;;;;;;;;AAIA;AACA;AACA;AACA;;AAIA,SAASA,OAAO,CAACC,CAAC,EAAE;EAClB,OAAOA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI;AACtC;;AAGA,IAAME,YAAY,GAAG,IAAIC,aAAO,EAAE;AAClC,IAAMC,gBAAgB,GAAG,IAAID,aAAO,EAAE;AACtC,IAAME,gBAAgB,GAAG,IAAIF,aAAO,EAAE;;AAY/B,SAASG,oBAAoB,CAACC,oBAAoB,EAAEC,SAAS,EAAEC,MAAM,EAAE;EAC5E,IAAAC,mBAAM,EAACH,oBAAoB,EAA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AM,EAAE1B,SAAS,EAAEC,MAAO,EAAE;EAEhD,IAAM2B,MAAM,GAAG,IAAIjC,aAAO,CAAC+B,MAAM,CAAC,CAAC,CAAC,EAAEA,MAAM,CAAC,CAAC,CAAC,EAAEA,MAAM,CAAC,CAAC,CAAC,CAAC;EAC3D1B,SAAS,CAACA,SAAS,CAAC4B,MAAM,EAAEA,MAAM,CAAC;EACnC,IAAMW,KAAK,GAAGvC,SAAS,CAACgD,QAAQ,CAACtD,YAAY,CAAC;EAE9C,IAAMuD,YAAY,GAAGC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACC,GAAG,CAACZ,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,CAAC;EACrE,IAAMlB,MAAM,GAAGK,MAAM,CAAC,CAAC,CAAC,GAAGuB,YAAY;EAEvC,IAAI1D,OAAO,CAACU,MAAM,CAAC,EAAE;IACnBA,MAAM,CAAC2B,MAAM,GAAGA,MAAM;IACtB3B,MAAM,CAACoB,MAAM,GAAGA,MAAM;IACtB,OAAOpB,MAAM;EACf;EAEA,OAAO,IAAImD,uBAAc,CAACxB,MAAM,EAAEP,MAAM,CAAC;AAC3C"}
|
|
1
|
+
{"version":3,"file":"bounding-volume.js","names":["defined","x","undefined","scratchPoint","Vector3","scratchScale","scratchNorthWest","scratchSouthEast","createBoundingVolume","boundingVolumeHeader","transform","result","assert","box","createBox","region","west","south","east","north","minHeight","maxHeight","northWest","Ellipsoid","WGS84","cartographicToCartesian","degrees","southEast","centerInCartesian","addVectors","multiplyScalar","radius","subVectors","len","createSphere","Matrix4","sphere","Error","getCartographicBounds","boundingVolume","orientedBoundingBoxToCartographicBounds","boundingSphereToCartographicBounds","center","origin","length","halfSize","slice","quaternion","Quaternion","fromArray","y","z","transformByQuaternion","scale","toArray","xAxis","transformAsVector","yAxis","zAxis","halfAxes","Matrix3","OrientedBoundingBox","getScale","uniformScale","Math","max","BoundingSphere","emptyCartographicBounds","getColumn","copy","add","addToCartographicBounds","negate","point","scaleToGeodeticSurface","geodeticSurfaceNormal","normalize","clone","cross","axis","dir","Infinity","target","cartesian","cartesianToCartographic","min"],"sources":["../../../../src/tileset/helpers/bounding-volume.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Quaternion, Vector3, Matrix3, Matrix4, degrees} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {assert} from '@loaders.gl/loader-utils';\n\n// const scratchProjectedBoundingSphere = new BoundingSphere();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n// const scratchMatrix = new Matrix3();\nconst scratchPoint = new Vector3();\nconst scratchScale = new Vector3();\nconst scratchNorthWest = new Vector3();\nconst scratchSouthEast = new Vector3();\n// const scratchRectangle = new Rectangle();\n// const scratchOrientedBoundingBox = new OrientedBoundingBox();\n// const scratchTransform = new Matrix4();\n\n/**\n * Create a bounding volume from the tile's bounding volume header.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {Matrix4} transform The transform to apply to the bounding volume.\n * @param [result] The object onto which to store the result.\n * @returns The modified result parameter or a new TileBoundingVolume instance if none was provided.\n */\nexport function createBoundingVolume(boundingVolumeHeader, transform, result) {\n assert(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');\n\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return createBox(boundingVolumeHeader.box, transform, result);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n const northWest = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(west), degrees(north), minHeight],\n scratchNorthWest\n );\n const southEast = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(east), degrees(south), maxHeight],\n scratchSouthEast\n );\n const centerInCartesian = new Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);\n const radius = new Vector3().subVectors(northWest, southEast).len() / 2.0;\n\n // TODO improve region boundingVolume\n // for now, create a sphere as the boundingVolume instead of box\n return createSphere(\n [centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius],\n new Matrix4()\n );\n }\n\n if (boundingVolumeHeader.sphere) {\n return createSphere(boundingVolumeHeader.sphere, transform, result);\n }\n\n throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');\n}\n\n/** [min, max] each in [longitude, latitude, altitude] */\nexport type CartographicBounds = [min: number[], max: number[]];\n\n/**\n * Calculate the cartographic bounding box the tile's bounding volume.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {BoundingVolume} boundingVolume The bounding volume.\n * @returns {CartographicBounds}\n */\nexport function getCartographicBounds(\n boundingVolumeHeader,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): CartographicBounds {\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return orientedBoundingBoxToCartographicBounds(boundingVolume as OrientedBoundingBox);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n return [\n [degrees(west), degrees(south), minHeight],\n [degrees(east), degrees(north), maxHeight]\n ];\n }\n\n if (boundingVolumeHeader.sphere) {\n return boundingSphereToCartographicBounds(boundingVolume as BoundingSphere);\n }\n\n throw new Error('Unkown boundingVolume type');\n}\n\nfunction createBox(box, transform, result) {\n // https://math.gl/modules/culling/docs/api-reference/oriented-bounding-box\n // 1. A half-axes based representation.\n // box: An array of 12 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box.\n // The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length.\n // The next three elements (indices 6, 7, and 8) define the y axis direction and half-length.\n // The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.\n // 2. A half-size-quaternion based representation.\n // box: An array of 10 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box in a right-handed 3-axis (x, y, z) Cartesian coordinate system where the z-axis is up.\n // The next three elements (with indices 3, 4, and 5) define the halfSize.\n // The last four elements (indices 6, 7, 8 and 10) define the quaternion.\n const center = new Vector3(box[0], box[1], box[2]);\n transform.transform(center, center);\n let origin: number[] = [];\n if (box.length === 10) {\n const halfSize = box.slice(3, 6);\n const quaternion = new Quaternion();\n quaternion.fromArray(box, 6);\n const x = new Vector3([1, 0, 0]);\n const y = new Vector3([0, 1, 0]);\n const z = new Vector3([0, 0, 1]);\n x.transformByQuaternion(quaternion);\n x.scale(halfSize[0]);\n y.transformByQuaternion(quaternion);\n y.scale(halfSize[1]);\n z.transformByQuaternion(quaternion);\n z.scale(halfSize[2]);\n origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];\n } else {\n origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];\n }\n const xAxis = transform.transformAsVector(origin.slice(0, 3));\n const yAxis = transform.transformAsVector(origin.slice(3, 6));\n const zAxis = transform.transformAsVector(origin.slice(6, 9));\n const halfAxes = new Matrix3([\n xAxis[0],\n xAxis[1],\n xAxis[2],\n yAxis[0],\n yAxis[1],\n yAxis[2],\n zAxis[0],\n zAxis[1],\n zAxis[2]\n ]);\n\n if (defined(result)) {\n result.center = center;\n result.halfAxes = halfAxes;\n return result;\n }\n\n return new OrientedBoundingBox(center, halfAxes);\n}\n\n/*\nfunction createBoxFromTransformedRegion(region, transform, initialTransform, result) {\n const rectangle = Rectangle.unpack(region, 0, scratchRectangle);\n const minimumHeight = region[4];\n const maximumHeight = region[5];\n\n const orientedBoundingBox = OrientedBoundingBox.fromRectangle(\n rectangle,\n minimumHeight,\n maximumHeight,\n Ellipsoid.WGS84,\n scratchOrientedBoundingBox\n );\n const center = orientedBoundingBox.center;\n const halfAxes = orientedBoundingBox.halfAxes;\n\n // A region bounding volume is not transformed by the transform in the tileset JSON,\n // but may be transformed by additional transforms applied in Cesium.\n // This is why the transform is calculated as the difference between the initial transform and the current transform.\n transform = Matrix4.multiplyTransformation(\n transform,\n Matrix4.inverseTransformation(initialTransform, scratchTransform),\n scratchTransform\n );\n center = Matrix4.multiplyByPoint(transform, center, center);\n const rotationScale = Matrix4.getRotation(transform, scratchMatrix);\n halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);\n\n if (defined(result) && result instanceof TileOrientedBoundingBox) {\n result.update(center, halfAxes);\n return result;\n }\n\n return new TileOrientedBoundingBox(center, halfAxes);\n}\n\nfunction createRegion(region, transform, initialTransform, result) {\n if (!Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)) {\n return createBoxFromTransformedRegion(region, transform, initialTransform, result);\n }\n\n if (defined(result)) {\n return result;\n }\n\n const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);\n\n return new TileBoundingRegion({\n rectangle: rectangleRegion,\n minimumHeight: region[4],\n maximumHeight: region[5]\n });\n}\n*/\n\nfunction createSphere(sphere, transform, result?) {\n // Find the transformed center\n const center = new Vector3(sphere[0], sphere[1], sphere[2]);\n transform.transform(center, center);\n const scale = transform.getScale(scratchScale);\n\n const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);\n const radius = sphere[3] * uniformScale;\n\n if (defined(result)) {\n result.center = center;\n result.radius = radius;\n return result;\n }\n\n return new BoundingSphere(center, radius);\n}\n\n/**\n * Convert a bounding volume defined by OrientedBoundingBox to cartographic bounds\n * @returns {CartographicBounds}\n */\nfunction orientedBoundingBoxToCartographicBounds(\n boundingVolume: OrientedBoundingBox\n): CartographicBounds {\n const result = emptyCartographicBounds();\n\n const {halfAxes} = boundingVolume as OrientedBoundingBox;\n const xAxis = new Vector3(halfAxes.getColumn(0));\n const yAxis = new Vector3(halfAxes.getColumn(1));\n const zAxis = new Vector3(halfAxes.getColumn(2));\n\n // Test all 8 corners of the box\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 2; y++) {\n for (let z = 0; z < 2; z++) {\n scratchPoint.copy(boundingVolume.center);\n scratchPoint.add(xAxis);\n scratchPoint.add(yAxis);\n scratchPoint.add(zAxis);\n\n addToCartographicBounds(result, scratchPoint);\n zAxis.negate();\n }\n yAxis.negate();\n }\n xAxis.negate();\n }\n return result;\n}\n\n/**\n * Convert a bounding volume defined by BoundingSphere to cartographic bounds\n * @returns {CartographicBounds}\n */\nfunction boundingSphereToCartographicBounds(boundingVolume: BoundingSphere): CartographicBounds {\n const result = emptyCartographicBounds();\n\n const {center, radius} = boundingVolume as BoundingSphere;\n const point = Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);\n\n let zAxis: Vector3;\n if (point) {\n zAxis = Ellipsoid.WGS84.geodeticSurfaceNormal(point) as Vector3;\n } else {\n zAxis = new Vector3(0, 0, 1);\n }\n let xAxis = new Vector3(zAxis[2], -zAxis[1], 0);\n if (xAxis.len() > 0) {\n xAxis.normalize();\n } else {\n xAxis = new Vector3(0, 1, 0);\n }\n const yAxis = xAxis.clone().cross(zAxis);\n\n // Test 6 end points of the 3 axes\n for (const axis of [xAxis, yAxis, zAxis]) {\n scratchScale.copy(axis).scale(radius);\n for (let dir = 0; dir < 2; dir++) {\n scratchPoint.copy(center);\n scratchPoint.add(scratchScale);\n addToCartographicBounds(result, scratchPoint);\n // Flip the axis\n scratchScale.negate();\n }\n }\n return result;\n}\n\n/**\n * Create a new cartographic bounds that contains no points\n * @returns {CartographicBounds}\n */\nfunction emptyCartographicBounds(): CartographicBounds {\n return [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n}\n\n/**\n * Add a point to the target cartographic bounds\n * @param {CartographicBounds} target\n * @param {Vector3} cartesian coordinates of the point to add\n */\nfunction addToCartographicBounds(target: CartographicBounds, cartesian: Readonly<Vector3>) {\n Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);\n target[0][0] = Math.min(target[0][0], scratchPoint[0]);\n target[0][1] = Math.min(target[0][1], scratchPoint[1]);\n target[0][2] = Math.min(target[0][2], scratchPoint[2]);\n\n target[1][0] = Math.max(target[1][0], scratchPoint[0]);\n target[1][1] = Math.max(target[1][1], scratchPoint[1]);\n target[1][2] = Math.max(target[1][2], scratchPoint[2]);\n}\n"],"mappings":";;;;;;;;;;AAIA;AACA;AACA;AACA;;AAIA,SAASA,OAAO,CAACC,CAAC,EAAE;EAClB,OAAOA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI;AACtC;;AAGA,IAAME,YAAY,GAAG,IAAIC,aAAO,EAAE;AAClC,IAAMC,YAAY,GAAG,IAAID,aAAO,EAAE;AAClC,IAAME,gBAAgB,GAAG,IAAIF,aAAO,EAAE;AACtC,IAAMG,gBAAgB,GAAG,IAAIH,aAAO,EAAE;;AAY/B,SAASI,oBAAoB,CAACC,oBAAoB,EAAEC,SAAS,EAAEC,MAAM,EAAE;EAC5E,IAAAC,mBAAM,EAACH,oBAAoB,EAAE,yCAAyC,CAAC;;EAIvE,IAAIA,oBAAoB,CAACI,GAAG,EAAE;IAC5B,OAAOC,SAAS,CAACL,oBAAoB,CAACI,GAAG,EAAEH,SAAS,EAAEC,MAAM,CAAC;EAC/D;EACA,IAAIF,oBAAoB,CAACM,MAAM,EAAE;IAI/B,yDAAyDN,oBAAoB,CAACM,MAAM;MAA7EC,IAAI;MAAEC,KAAK;MAAEC,IAAI;MAAEC,KAAK;MAAEC,SAAS;MAAEC,SAAS;IAErD,IAAMC,SAAS,GAAGC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_defineProperty2.default)(this, "_expiredContent", void 0);
|
|
64
64
|
(0, _defineProperty2.default)(this, "_shouldRefine", void 0);
|
|
65
|
+
(0, _defineProperty2.default)(this, "_boundingBox", void 0);
|
|
65
66
|
(0, _defineProperty2.default)(this, "_distanceToCamera", void 0);
|
|
66
67
|
(0, _defineProperty2.default)(this, "_centerZDepth", void 0);
|
|
67
68
|
(0, _defineProperty2.default)(this, "_screenSpaceError", void 0);
|
|
@@ -235,6 +236,16 @@ var Tile3D = function () {
|
|
|
235
236
|
return this._screenSpaceError;
|
|
236
237
|
}
|
|
237
238
|
|
|
239
|
+
}, {
|
|
240
|
+
key: "boundingBox",
|
|
241
|
+
get:
|
|
242
|
+
function get() {
|
|
243
|
+
if (!this._boundingBox) {
|
|
244
|
+
this._boundingBox = (0, _boundingVolume.getCartographicBounds)(this.header.boundingVolume, this.boundingVolume);
|
|
245
|
+
}
|
|
246
|
+
return this._boundingBox;
|
|
247
|
+
}
|
|
248
|
+
|
|
238
249
|
}, {
|
|
239
250
|
key: "getScreenSpaceError",
|
|
240
251
|
value:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-3d.js","names":["scratchVector","Vector3","defined","x","undefined","Tile3D","tileset","header","parentHeader","extendedId","id","url","parent","refine","_getRefine","type","contentUrl","lodMetricType","lodMetricValue","boundingVolume","content","contentState","TILE_CONTENT_STATE","UNLOADED","gpuMemoryUsageInBytes","children","hasEmptyContent","hasTilesetContent","depth","viewportIds","userData","extensions","_priority","_touchedFrame","_visitedFrame","_selectedFrame","_requestedFrame","_screenSpaceError","_cacheNode","_frameNumber","traverser","TilesetTraverser","_shouldRefine","_distanceToCamera","_centerZDepth","_visible","_inRequestVolume","_stackLength","_selectionDepth","_initialTransform","Matrix4","transform","_initializeLodMetric","_initializeTransforms","_initializeBoundingVolumes","_initializeContent","_initializeRenderingState","_lodJudge","_expireDate","_expiredContent","implicitTiling","Object","seal","length","READY","Boolean","contentReady","hasRenderContent","contentFailed","contentUnloaded","EXPIRED","FAILED","frameState","useParentLodMetric","TILESET_TYPE","I3S","getProjectedRadius","TILES3D","getTiles3DScreenSpaceError","Error","_traverser","skipLevelOfDetail","options","maySkipTile","TILE_REFINEMENT","ADD","isVisible","useParentScreenSpaceError","screenSpaceError","rootScreenSpaceError","root","Math","max","expired","contentExpired","LOADING","_requestScheduler","scheduleRequest","_getPriority","bind","requestToken","getTileUrl","loader","loadOptions","isTileset","_getLoaderSpecificOptions","load","contentLoader","_isTileset","_initializeTileHeaders","_onContentLoaded","done","destroy","frameNumber","parentVisibilityPlaneMask","_visibilityPlaneMask","CullingVolume","MASK_INDETERMINATE","updateTransforms","parentTransform","computedTransform","modelMatrix","_updateTransform","distanceToTile","getScreenSpaceError","visibility","MASK_OUTSIDE","insideViewerRequestVolume","cullingVolume","computeVisibilityWithPlaneMask","sqrt","distanceSquaredTo","camera","position","subVectors","center","direction","dot","viewerRequestVolume","_viewerRequestVolume","now","Date","lessThan","extras","console","warn","tileHeader","clone","multiplyRight","parentInitialTransform","_contentBoundingVolume","_updateBoundingVolume","_tileset","_tile","level","REPLACE","indexOf","disableSkipLevelOfDetail","createBoundingVolume","didTransformChange","equals","loaderId","i3s","_tileOptions","attributeUrls","textureUrl","textureFormat","textureLoaderOptions","materialDefinition","isDracoGeometry","mbs","_tilesetOptions","store","attributeStorageInfo","fields","isTileHeader","get3dTilesOptions"],"sources":["../../../src/tileset/tile-3d.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {CullingVolume} from '@math.gl/culling';\n\nimport {load} from '@loaders.gl/core';\n\n// Note: circular dependency\nimport type {Tileset3D} from './tileset-3d';\nimport {TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE} from '../constants';\n\nimport {FrameState} from './helpers/frame-state';\nimport {createBoundingVolume} from './helpers/bounding-volume';\nimport {getTiles3DScreenSpaceError} from './helpers/tiles-3d-lod';\nimport {getProjectedRadius} from './helpers/i3s-lod';\nimport {get3dTilesOptions} from './helpers/3d-tiles-options';\nimport {TilesetTraverser} from './tileset-traverser';\n\nconst scratchVector = new Vector3();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n/**\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\nexport type Tile3DProps = {\n tileset: Tileset3D;\n header: Object;\n parentHeader: Tile3D;\n extendedId: string;\n};\n\n/**\n * A Tile3DHeader represents a tile as Tileset3D. When a tile is first created, its content is not loaded;\n * the content is loaded on-demand when needed based on the view.\n * Do not construct this directly, instead access tiles through {@link Tileset3D#tileVisible}.\n */\nexport class Tile3D {\n tileset: Tileset3D;\n header: any;\n id: string;\n url: string;\n parent: Tile3D;\n refine: number;\n type: string;\n contentUrl: string;\n lodMetricType: string;\n lodMetricValue: number;\n boundingVolume: any;\n content: any;\n contentState: any;\n gpuMemoryUsageInBytes: number;\n children: Tile3D[];\n depth: number;\n viewportIds: any[];\n transform: Matrix4;\n extensions: any;\n implicitTiling?: any;\n\n // Container to store application specific data\n userData: {[key: string]: any};\n computedTransform: any;\n hasEmptyContent: boolean;\n hasTilesetContent: boolean;\n\n traverser: object;\n\n // @ts-ignore\n private _cacheNode: any;\n private _frameNumber: any;\n // TODO i3s specific, needs to remove\n // @ts-ignore\n private _lodJudge: any;\n // TODO Cesium 3d tiles specific\n private _expireDate: any;\n private _expiredContent: any;\n // @ts-ignore\n private _shouldRefine: boolean;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n public _distanceToCamera: number;\n // @ts-ignore\n private _centerZDepth: number;\n private _screenSpaceError: number;\n private _visibilityPlaneMask: any;\n private _visible?: boolean;\n private _inRequestVolume: boolean;\n\n // @ts-ignore\n private _stackLength: number;\n // @ts-ignore\n private _selectionDepth: number;\n\n // @ts-ignore\n private _touchedFrame: number;\n // @ts-ignore\n private _visitedFrame: number;\n private _selectedFrame: number;\n // @ts-ignore\n private _requestedFrame: number;\n\n // @ts-ignore\n private _priority: number;\n\n private _contentBoundingVolume: any;\n private _viewerRequestVolume: any;\n\n _initialTransform: Matrix4;\n\n /**\n * @constructs\n * Create a Tile3D instance\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\n // eslint-disable-next-line max-statements\n constructor(\n tileset: Tileset3D,\n header: {[key: string]: any},\n parentHeader?: Tile3D,\n extendedId = ''\n ) {\n // PUBLIC MEMBERS\n // original tile data\n this.header = header;\n\n // The tileset containing this tile.\n this.tileset = tileset;\n this.id = extendedId || header.id;\n this.url = header.url;\n\n // This tile's parent or `undefined` if this tile is the root.\n // @ts-ignore\n this.parent = parentHeader;\n this.refine = this._getRefine(header.refine);\n this.type = header.type;\n this.contentUrl = header.contentUrl;\n\n // The error, in meters, introduced if this tile is rendered and its children are not.\n this.lodMetricType = 'geometricError';\n this.lodMetricValue = 0;\n\n // Specifies the type of refine that is used when traversing this tile for rendering.\n this.boundingVolume = null;\n\n // The tile's content. This represents the actual tile's payload,\n // not the content's metadata in the tileset JSON file.\n this.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n this.gpuMemoryUsageInBytes = 0;\n\n // The tile's children - an array of Tile3D objects.\n this.children = [];\n\n this.hasEmptyContent = false;\n this.hasTilesetContent = false;\n\n this.depth = 0;\n this.viewportIds = [];\n\n // Container to store application specific data\n this.userData = {};\n this.extensions = null;\n\n // PRIVATE MEMBERS\n this._priority = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n this._screenSpaceError = 0;\n\n this._cacheNode = null;\n this._frameNumber = null;\n this._cacheNode = null;\n\n this.traverser = new TilesetTraverser({});\n this._shouldRefine = false;\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._visible = undefined;\n this._inRequestVolume = false;\n this._stackLength = 0;\n this._selectionDepth = 0;\n this._initialTransform = new Matrix4();\n this.transform = new Matrix4();\n\n this._initializeLodMetric(header);\n this._initializeTransforms(header);\n this._initializeBoundingVolumes(header);\n this._initializeContent(header);\n this._initializeRenderingState(header);\n\n // TODO i3s specific, needs to remove\n this._lodJudge = null;\n\n // TODO Cesium 3d tiles specific\n this._expireDate = null;\n this._expiredContent = null;\n this.implicitTiling = null;\n\n Object.seal(this);\n }\n\n destroy() {\n this.header = null;\n }\n\n isDestroyed() {\n return this.header === null;\n }\n\n get selected() {\n return this._selectedFrame === this.tileset._frameNumber;\n }\n\n get isVisible() {\n return this._visible;\n }\n\n get isVisibleAndInRequestVolume() {\n return this._visible && this._inRequestVolume;\n }\n\n /** Returns true if tile is not an empty tile and not an external tileset */\n get hasRenderContent() {\n return !this.hasEmptyContent && !this.hasTilesetContent;\n }\n\n /** Returns true if tile has children */\n get hasChildren() {\n return this.children.length > 0 || (this.header.children && this.header.children.length > 0);\n }\n\n /**\n * Determines if the tile's content is ready. This is automatically `true` for\n * tiles with empty content.\n */\n get contentReady() {\n return this.contentState === TILE_CONTENT_STATE.READY || this.hasEmptyContent;\n }\n\n /**\n * Determines if the tile has available content to render. `true` if the tile's\n * content is ready or if it has expired content this renders while new content loads; otherwise,\n */\n get contentAvailable() {\n return Boolean(\n (this.contentReady && this.hasRenderContent) || (this._expiredContent && !this.contentFailed)\n );\n }\n\n /** Returns true if tile has renderable content but it's unloaded */\n get hasUnloadedContent() {\n return this.hasRenderContent && this.contentUnloaded;\n }\n\n /**\n * Determines if the tile's content has not be requested. `true` if tile's\n * content has not be requested; otherwise, `false`.\n */\n get contentUnloaded() {\n return this.contentState === TILE_CONTENT_STATE.UNLOADED;\n }\n\n /**\n * Determines if the tile's content is expired. `true` if tile's\n * content is expired; otherwise, `false`.\n */\n get contentExpired() {\n return this.contentState === TILE_CONTENT_STATE.EXPIRED;\n }\n\n // Determines if the tile's content failed to load. `true` if the tile's\n // content failed to load; otherwise, `false`.\n get contentFailed() {\n return this.contentState === TILE_CONTENT_STATE.FAILED;\n }\n\n /**\n * Distance from the tile's bounding volume center to the camera\n */\n get distanceToCamera(): number {\n return this._distanceToCamera;\n }\n\n /**\n * Screen space error for LOD selection\n */\n get screenSpaceError(): number {\n return this._screenSpaceError;\n }\n\n /** Get the tile's screen space error. */\n getScreenSpaceError(frameState, useParentLodMetric) {\n switch (this.tileset.type) {\n case TILESET_TYPE.I3S:\n return getProjectedRadius(this, frameState);\n case TILESET_TYPE.TILES3D:\n return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);\n default:\n // eslint-disable-next-line\n throw new Error('Unsupported tileset type');\n }\n }\n\n /**\n * Make tile unselected than means it won't be shown\n * but it can be still loaded in memory\n */\n unselect(): void {\n this._selectedFrame = 0;\n }\n\n /*\n * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.\n * Tiles are prioritized by screen space error.\n */\n // eslint-disable-next-line complexity\n _getPriority() {\n const traverser = this.tileset._traverser;\n const {skipLevelOfDetail} = traverser.options;\n\n /*\n * Tiles that are outside of the camera's frustum could be skipped if we are in 'ADD' mode\n * or if we are using 'Skip Traversal' in 'REPLACE' mode.\n * Otherewise, all 'touched' child tiles have to be loaded and displayed,\n * this may include tiles that are outide of the camera frustum (so that we can hide the parent tile).\n */\n const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;\n\n // Check if any reason to abort\n if (maySkipTile && !this.isVisible && this._visible !== undefined) {\n return -1;\n }\n // Condition used in `cancelOutOfViewRequests` function in CesiumJS/Cesium3DTileset.js\n if (this.tileset._frameNumber - this._touchedFrame >= 1) {\n return -1;\n }\n if (this.contentState === TILE_CONTENT_STATE.UNLOADED) {\n return -1;\n }\n\n // Based on the priority function `getPriorityReverseScreenSpaceError` in CesiumJS. Scheduling priority is based on the parent's screen space error when possible.\n const parent = this.parent;\n const useParentScreenSpaceError =\n parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);\n const screenSpaceError = useParentScreenSpaceError\n ? parent._screenSpaceError\n : this._screenSpaceError;\n\n const rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;\n\n // Map higher SSE to lower values (e.g. root tile is highest priority)\n return Math.max(rootScreenSpaceError - screenSpaceError, 0);\n }\n\n /**\n * Requests the tile's content.\n * The request may not be made if the Request Scheduler can't prioritize it.\n */\n // eslint-disable-next-line max-statements, complexity\n async loadContent(): Promise<boolean> {\n if (this.hasEmptyContent) {\n return false;\n }\n\n if (this.content) {\n return true;\n }\n\n const expired = this.contentExpired;\n\n if (expired) {\n this._expireDate = null;\n }\n\n this.contentState = TILE_CONTENT_STATE.LOADING;\n\n const requestToken = await this.tileset._requestScheduler.scheduleRequest(\n this.id,\n this._getPriority.bind(this)\n );\n\n if (!requestToken) {\n // cancelled\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return false;\n }\n\n try {\n const contentUrl = this.tileset.getTileUrl(this.contentUrl);\n // The content can be a binary tile ot a JSON tileset\n const loader = this.tileset.loader;\n const options = {\n ...this.tileset.loadOptions,\n [loader.id]: {\n ...this.tileset.loadOptions[loader.id],\n isTileset: this.type === 'json',\n ...this._getLoaderSpecificOptions(loader.id)\n }\n };\n\n this.content = await load(contentUrl, loader, options);\n\n if (this.tileset.options.contentLoader) {\n await this.tileset.options.contentLoader(this);\n }\n\n if (this._isTileset()) {\n // Add tile headers for the nested tilset's subtree\n // Async update of the tree should be fine since there would never be edits to the same node\n // TODO - we need to capture the child tileset's URL\n this.tileset._initializeTileHeaders(this.content, this);\n }\n\n this.contentState = TILE_CONTENT_STATE.READY;\n this._onContentLoaded();\n return true;\n } catch (error) {\n // Tile is unloaded before the content finishes loading\n this.contentState = TILE_CONTENT_STATE.FAILED;\n throw error;\n } finally {\n requestToken.done();\n }\n }\n\n // Unloads the tile's content.\n unloadContent() {\n if (this.content && this.content.destroy) {\n this.content.destroy();\n }\n this.content = null;\n if (this.header.content && this.header.content.destroy) {\n this.header.content.destroy();\n }\n this.header.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return true;\n }\n\n /**\n * Update the tile's visibility\n * @param {Object} frameState - frame state for tile culling\n * @param {string[]} viewportIds - a list of viewport ids that show this tile\n * @return {void}\n */\n updateVisibility(frameState, viewportIds) {\n if (this._frameNumber === frameState.frameNumber) {\n // Return early if visibility has already been checked during the traversal.\n // The visibility may have already been checked if the cullWithChildrenBounds optimization is used.\n return;\n }\n\n const parent = this.parent;\n const parentVisibilityPlaneMask = parent\n ? parent._visibilityPlaneMask\n : CullingVolume.MASK_INDETERMINATE;\n\n if (this.tileset._traverser.options.updateTransforms) {\n const parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;\n this._updateTransform(parentTransform);\n }\n\n this._distanceToCamera = this.distanceToTile(frameState);\n this._screenSpaceError = this.getScreenSpaceError(frameState, false);\n this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask); // Use parent's plane mask to speed up visibility test\n this._visible = this._visibilityPlaneMask !== CullingVolume.MASK_OUTSIDE;\n this._inRequestVolume = this.insideViewerRequestVolume(frameState);\n\n this._frameNumber = frameState.frameNumber;\n this.viewportIds = viewportIds;\n }\n\n // Determines whether the tile's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check.\n // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}.\n visibility(frameState, parentVisibilityPlaneMask) {\n const {cullingVolume} = frameState;\n const {boundingVolume} = this;\n\n // TODO Cesium specific - restore clippingPlanes\n // const {clippingPlanes, clippingPlanesOriginMatrix} = tileset;\n // if (clippingPlanes && clippingPlanes.enabled) {\n // const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n // boundingVolume,\n // clippingPlanesOriginMatrix\n // );\n // this._isClipped = intersection !== Intersect.INSIDE;\n // if (intersection === Intersect.OUTSIDE) {\n // return CullingVolume.MASK_OUTSIDE;\n // }\n // }\n\n // return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n }\n\n // Assuming the tile's bounding volume intersects the culling volume, determines\n // whether the tile's content's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume.\n contentVisibility() {\n return true;\n\n // TODO restore\n /*\n // Assumes the tile's bounding volume intersects the culling volume already, so\n // just return Intersect.INSIDE if there is no content bounding volume.\n if (!defined(this.contentBoundingVolume)) {\n return Intersect.INSIDE;\n }\n\n if (this._visibilityPlaneMask === CullingVolume.MASK_INSIDE) {\n // The tile's bounding volume is completely inside the culling volume so\n // the content bounding volume must also be inside.\n return Intersect.INSIDE;\n }\n\n // PERFORMANCE_IDEA: is it possible to burn less CPU on this test since we know the\n // tile's (not the content's) bounding volume intersects the culling volume?\n const cullingVolume = frameState.cullingVolume;\n const boundingVolume = tile.contentBoundingVolume;\n\n const tileset = this.tileset;\n const clippingPlanes = tileset.clippingPlanes;\n if (defined(clippingPlanes) && clippingPlanes.enabled) {\n const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n boundingVolume,\n tileset.clippingPlanesOriginMatrix\n );\n this._isClipped = intersection !== Intersect.INSIDE;\n if (intersection === Intersect.OUTSIDE) {\n return Intersect.OUTSIDE;\n }\n }\n\n return cullingVolume.computeVisibility(boundingVolume);\n */\n }\n\n /**\n * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.\n * @param frameState The frame state.\n * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.\n */\n distanceToTile(frameState: FrameState): number {\n const boundingVolume = this.boundingVolume;\n return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));\n }\n\n /**\n * Computes the tile's camera-space z-depth.\n * @param frameState The frame state.\n * @returns The distance, in meters.\n */\n cameraSpaceZDepth({camera}): number {\n const boundingVolume = this.boundingVolume; // Gets the underlying OrientedBoundingBox or BoundingSphere\n scratchVector.subVectors(boundingVolume.center, camera.position);\n return camera.direction.dot(scratchVector);\n }\n\n /**\n * Checks if the camera is inside the viewer request volume.\n * @param {FrameState} frameState The frame state.\n * @returns {Boolean} Whether the camera is inside the volume.\n */\n insideViewerRequestVolume(frameState: FrameState) {\n const viewerRequestVolume = this._viewerRequestVolume;\n return (\n !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0\n );\n }\n\n // TODO Cesium specific\n\n // Update whether the tile has expired.\n updateExpiration() {\n if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {\n const now = Date.now();\n // @ts-ignore Date.lessThan - replace with ms compare?\n if (Date.lessThan(this._expireDate, now)) {\n this.contentState = TILE_CONTENT_STATE.EXPIRED;\n this._expiredContent = this.content;\n }\n }\n }\n\n get extras() {\n return this.header.extras;\n }\n\n // INTERNAL METHODS\n\n _initializeLodMetric(header) {\n if ('lodMetricType' in header) {\n this.lodMetricType = header.lodMetricType;\n } else {\n this.lodMetricType = (this.parent && this.parent.lodMetricType) || this.tileset.lodMetricType;\n // eslint-disable-next-line\n console.warn(`3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType`);\n }\n\n // This is used to compute screen space error, i.e., the error measured in pixels.\n if ('lodMetricValue' in header) {\n this.lodMetricValue = header.lodMetricValue;\n } else {\n this.lodMetricValue =\n (this.parent && this.parent.lodMetricValue) || this.tileset.lodMetricValue;\n // eslint-disable-next-line\n console.warn(\n '3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue'\n );\n }\n }\n\n _initializeTransforms(tileHeader) {\n // The local transform of this tile.\n this.transform = tileHeader.transform ? new Matrix4(tileHeader.transform) : new Matrix4();\n\n const parent = this.parent;\n const tileset = this.tileset;\n\n const parentTransform =\n parent && parent.computedTransform\n ? parent.computedTransform.clone()\n : tileset.modelMatrix.clone();\n this.computedTransform = new Matrix4(parentTransform).multiplyRight(this.transform);\n\n const parentInitialTransform =\n parent && parent._initialTransform ? parent._initialTransform.clone() : new Matrix4();\n this._initialTransform = new Matrix4(parentInitialTransform).multiplyRight(this.transform);\n }\n\n _initializeBoundingVolumes(tileHeader) {\n this._contentBoundingVolume = null;\n this._viewerRequestVolume = null;\n\n this._updateBoundingVolume(tileHeader);\n }\n\n _initializeContent(tileHeader) {\n // Empty tile by default\n this.content = {_tileset: this.tileset, _tile: this};\n this.hasEmptyContent = true;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n\n // When `true`, the tile's content points to an external tileset.\n // This is `false` until the tile's content is loaded.\n this.hasTilesetContent = false;\n\n if (tileHeader.contentUrl) {\n this.content = null;\n this.hasEmptyContent = false;\n }\n }\n\n // TODO - remove anything not related to basic visibility detection\n _initializeRenderingState(header) {\n this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);\n this._shouldRefine = false;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._screenSpaceError = 0;\n this._visibilityPlaneMask = CullingVolume.MASK_INDETERMINATE;\n this._visible = undefined;\n this._inRequestVolume = false;\n\n this._stackLength = 0;\n this._selectionDepth = 0;\n\n this._frameNumber = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n\n this._priority = 0.0;\n }\n\n _getRefine(refine) {\n // Inherit from parent tile if omitted.\n return refine || (this.parent && this.parent.refine) || TILE_REFINEMENT.REPLACE;\n }\n\n _isTileset() {\n return this.contentUrl.indexOf('.json') !== -1;\n }\n\n _onContentLoaded() {\n // Vector and Geometry tile rendering do not support the skip LOD optimization.\n switch (this.content && this.content.type) {\n case 'vctr':\n case 'geom':\n // @ts-ignore\n this.tileset._traverser.disableSkipLevelOfDetail = true;\n break;\n default:\n }\n\n // The content may be tileset json\n if (this._isTileset()) {\n this.hasTilesetContent = true;\n }\n }\n\n _updateBoundingVolume(header) {\n // Update the bounding volumes\n this.boundingVolume = createBoundingVolume(\n header.boundingVolume,\n this.computedTransform,\n this.boundingVolume\n );\n\n const content = header.content;\n if (!content) {\n return;\n }\n\n // TODO Cesium specific\n // Non-leaf tiles may have a content bounding-volume, which is a tight-fit bounding volume\n // around only the features in the tile. This box is useful for culling for rendering,\n // but not for culling for traversing the tree since it does not guarantee spatial coherence, i.e.,\n // since it only bounds features in the tile, not the entire tile, children may be\n // outside of this box.\n if (content.boundingVolume) {\n this._contentBoundingVolume = createBoundingVolume(\n content.boundingVolume,\n this.computedTransform,\n this._contentBoundingVolume\n );\n }\n if (header.viewerRequestVolume) {\n this._viewerRequestVolume = createBoundingVolume(\n header.viewerRequestVolume,\n this.computedTransform,\n this._viewerRequestVolume\n );\n }\n }\n\n // Update the tile's transform. The transform is applied to the tile's bounding volumes.\n _updateTransform(parentTransform = new Matrix4()) {\n const computedTransform = parentTransform.clone().multiplyRight(this.transform);\n const didTransformChange = !computedTransform.equals(this.computedTransform);\n\n if (!didTransformChange) {\n return;\n }\n\n this.computedTransform = computedTransform;\n\n this._updateBoundingVolume(this.header);\n }\n\n // Get options which are applicable only for the particular loader\n _getLoaderSpecificOptions(loaderId) {\n switch (loaderId) {\n case 'i3s':\n return {\n ...this.tileset.options.i3s,\n _tileOptions: {\n attributeUrls: this.header.attributeUrls,\n textureUrl: this.header.textureUrl,\n textureFormat: this.header.textureFormat,\n textureLoaderOptions: this.header.textureLoaderOptions,\n materialDefinition: this.header.materialDefinition,\n isDracoGeometry: this.header.isDracoGeometry,\n mbs: this.header.mbs\n },\n _tilesetOptions: {\n store: this.tileset.tileset.store,\n attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,\n fields: this.tileset.tileset.fields\n },\n isTileHeader: false\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AAE,IAAI,CAACxK,OAAO,CAACA,OAAO,CAACwK;YAC/B,CAAC;YACDC,YAAY,EAAE;UAAK;QAEvB,KAAK,UAAU;QACf,KAAK,YAAY;QACjB;UACE,OAAO,IAAAC,gCAAiB,EAAC,IAAI,CAAC1K,OAAO,CAACA,OAAO,CAAC;MAAC;IAErD;EAAC;EAAA;AAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"tile-3d.js","names":["scratchVector","Vector3","defined","x","undefined","Tile3D","tileset","header","parentHeader","extendedId","id","url","parent","refine","_getRefine","type","contentUrl","lodMetricType","lodMetricValue","boundingVolume","content","contentState","TILE_CONTENT_STATE","UNLOADED","gpuMemoryUsageInBytes","children","hasEmptyContent","hasTilesetContent","depth","viewportIds","userData","extensions","_priority","_touchedFrame","_visitedFrame","_selectedFrame","_requestedFrame","_screenSpaceError","_cacheNode","_frameNumber","traverser","TilesetTraverser","_shouldRefine","_distanceToCamera","_centerZDepth","_visible","_inRequestVolume","_stackLength","_selectionDepth","_initialTransform","Matrix4","transform","_initializeLodMetric","_initializeTransforms","_initializeBoundingVolumes","_initializeContent","_initializeRenderingState","_lodJudge","_expireDate","_expiredContent","implicitTiling","Object","seal","length","READY","Boolean","contentReady","hasRenderContent","contentFailed","contentUnloaded","EXPIRED","FAILED","_boundingBox","getCartographicBounds","frameState","useParentLodMetric","TILESET_TYPE","I3S","getProjectedRadius","TILES3D","getTiles3DScreenSpaceError","Error","_traverser","skipLevelOfDetail","options","maySkipTile","TILE_REFINEMENT","ADD","isVisible","useParentScreenSpaceError","screenSpaceError","rootScreenSpaceError","root","Math","max","expired","contentExpired","LOADING","_requestScheduler","scheduleRequest","_getPriority","bind","requestToken","getTileUrl","loader","loadOptions","isTileset","_getLoaderSpecificOptions","load","contentLoader","_isTileset","_initializeTileHeaders","_onContentLoaded","done","destroy","frameNumber","parentVisibilityPlaneMask","_visibilityPlaneMask","CullingVolume","MASK_INDETERMINATE","updateTransforms","parentTransform","computedTransform","modelMatrix","_updateTransform","distanceToTile","getScreenSpaceError","visibility","MASK_OUTSIDE","insideViewerRequestVolume","cullingVolume","computeVisibilityWithPlaneMask","sqrt","distanceSquaredTo","camera","position","subVectors","center","direction","dot","viewerRequestVolume","_viewerRequestVolume","now","Date","lessThan","extras","console","warn","tileHeader","clone","multiplyRight","parentInitialTransform","_contentBoundingVolume","_updateBoundingVolume","_tileset","_tile","level","REPLACE","indexOf","disableSkipLevelOfDetail","createBoundingVolume","didTransformChange","equals","loaderId","i3s","_tileOptions","attributeUrls","textureUrl","textureFormat","textureLoaderOptions","materialDefinition","isDracoGeometry","mbs","_tilesetOptions","store","attributeStorageInfo","fields","isTileHeader","get3dTilesOptions"],"sources":["../../../src/tileset/tile-3d.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {CullingVolume} from '@math.gl/culling';\n\nimport {load} from '@loaders.gl/core';\n\n// Note: circular dependency\nimport type {Tileset3D} from './tileset-3d';\nimport {TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE} from '../constants';\n\nimport {FrameState} from './helpers/frame-state';\nimport {\n createBoundingVolume,\n getCartographicBounds,\n CartographicBounds\n} from './helpers/bounding-volume';\nimport {getTiles3DScreenSpaceError} from './helpers/tiles-3d-lod';\nimport {getProjectedRadius} from './helpers/i3s-lod';\nimport {get3dTilesOptions} from './helpers/3d-tiles-options';\nimport {TilesetTraverser} from './tileset-traverser';\n\nconst scratchVector = new Vector3();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n/**\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\nexport type Tile3DProps = {\n tileset: Tileset3D;\n header: Object;\n parentHeader: Tile3D;\n extendedId: string;\n};\n\n/**\n * A Tile3DHeader represents a tile as Tileset3D. When a tile is first created, its content is not loaded;\n * the content is loaded on-demand when needed based on the view.\n * Do not construct this directly, instead access tiles through {@link Tileset3D#tileVisible}.\n */\nexport class Tile3D {\n tileset: Tileset3D;\n header: any;\n id: string;\n url: string;\n parent: Tile3D;\n refine: number;\n type: string;\n contentUrl: string;\n lodMetricType: string;\n lodMetricValue: number;\n boundingVolume: any;\n content: any;\n contentState: any;\n gpuMemoryUsageInBytes: number;\n children: Tile3D[];\n depth: number;\n viewportIds: any[];\n transform: Matrix4;\n extensions: any;\n implicitTiling?: any;\n\n // Container to store application specific data\n userData: {[key: string]: any};\n computedTransform: any;\n hasEmptyContent: boolean;\n hasTilesetContent: boolean;\n\n traverser: object;\n\n // @ts-ignore\n private _cacheNode: any;\n private _frameNumber: any;\n // TODO i3s specific, needs to remove\n // @ts-ignore\n private _lodJudge: any;\n // TODO Cesium 3d tiles specific\n private _expireDate: any;\n private _expiredContent: any;\n // @ts-ignore\n private _shouldRefine: boolean;\n\n private _boundingBox?: CartographicBounds;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n public _distanceToCamera: number;\n // @ts-ignore\n private _centerZDepth: number;\n private _screenSpaceError: number;\n private _visibilityPlaneMask: any;\n private _visible?: boolean;\n private _inRequestVolume: boolean;\n\n // @ts-ignore\n private _stackLength: number;\n // @ts-ignore\n private _selectionDepth: number;\n\n // @ts-ignore\n private _touchedFrame: number;\n // @ts-ignore\n private _visitedFrame: number;\n private _selectedFrame: number;\n // @ts-ignore\n private _requestedFrame: number;\n\n // @ts-ignore\n private _priority: number;\n\n private _contentBoundingVolume: any;\n private _viewerRequestVolume: any;\n\n _initialTransform: Matrix4;\n\n /**\n * @constructs\n * Create a Tile3D instance\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\n // eslint-disable-next-line max-statements\n constructor(\n tileset: Tileset3D,\n header: {[key: string]: any},\n parentHeader?: Tile3D,\n extendedId = ''\n ) {\n // PUBLIC MEMBERS\n // original tile data\n this.header = header;\n\n // The tileset containing this tile.\n this.tileset = tileset;\n this.id = extendedId || header.id;\n this.url = header.url;\n\n // This tile's parent or `undefined` if this tile is the root.\n // @ts-ignore\n this.parent = parentHeader;\n this.refine = this._getRefine(header.refine);\n this.type = header.type;\n this.contentUrl = header.contentUrl;\n\n // The error, in meters, introduced if this tile is rendered and its children are not.\n this.lodMetricType = 'geometricError';\n this.lodMetricValue = 0;\n\n // Specifies the type of refine that is used when traversing this tile for rendering.\n this.boundingVolume = null;\n\n // The tile's content. This represents the actual tile's payload,\n // not the content's metadata in the tileset JSON file.\n this.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n this.gpuMemoryUsageInBytes = 0;\n\n // The tile's children - an array of Tile3D objects.\n this.children = [];\n\n this.hasEmptyContent = false;\n this.hasTilesetContent = false;\n\n this.depth = 0;\n this.viewportIds = [];\n\n // Container to store application specific data\n this.userData = {};\n this.extensions = null;\n\n // PRIVATE MEMBERS\n this._priority = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n this._screenSpaceError = 0;\n\n this._cacheNode = null;\n this._frameNumber = null;\n this._cacheNode = null;\n\n this.traverser = new TilesetTraverser({});\n this._shouldRefine = false;\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._visible = undefined;\n this._inRequestVolume = false;\n this._stackLength = 0;\n this._selectionDepth = 0;\n this._initialTransform = new Matrix4();\n this.transform = new Matrix4();\n\n this._initializeLodMetric(header);\n this._initializeTransforms(header);\n this._initializeBoundingVolumes(header);\n this._initializeContent(header);\n this._initializeRenderingState(header);\n\n // TODO i3s specific, needs to remove\n this._lodJudge = null;\n\n // TODO Cesium 3d tiles specific\n this._expireDate = null;\n this._expiredContent = null;\n this.implicitTiling = null;\n\n Object.seal(this);\n }\n\n destroy() {\n this.header = null;\n }\n\n isDestroyed() {\n return this.header === null;\n }\n\n get selected() {\n return this._selectedFrame === this.tileset._frameNumber;\n }\n\n get isVisible() {\n return this._visible;\n }\n\n get isVisibleAndInRequestVolume() {\n return this._visible && this._inRequestVolume;\n }\n\n /** Returns true if tile is not an empty tile and not an external tileset */\n get hasRenderContent() {\n return !this.hasEmptyContent && !this.hasTilesetContent;\n }\n\n /** Returns true if tile has children */\n get hasChildren() {\n return this.children.length > 0 || (this.header.children && this.header.children.length > 0);\n }\n\n /**\n * Determines if the tile's content is ready. This is automatically `true` for\n * tiles with empty content.\n */\n get contentReady() {\n return this.contentState === TILE_CONTENT_STATE.READY || this.hasEmptyContent;\n }\n\n /**\n * Determines if the tile has available content to render. `true` if the tile's\n * content is ready or if it has expired content this renders while new content loads; otherwise,\n */\n get contentAvailable() {\n return Boolean(\n (this.contentReady && this.hasRenderContent) || (this._expiredContent && !this.contentFailed)\n );\n }\n\n /** Returns true if tile has renderable content but it's unloaded */\n get hasUnloadedContent() {\n return this.hasRenderContent && this.contentUnloaded;\n }\n\n /**\n * Determines if the tile's content has not be requested. `true` if tile's\n * content has not be requested; otherwise, `false`.\n */\n get contentUnloaded() {\n return this.contentState === TILE_CONTENT_STATE.UNLOADED;\n }\n\n /**\n * Determines if the tile's content is expired. `true` if tile's\n * content is expired; otherwise, `false`.\n */\n get contentExpired() {\n return this.contentState === TILE_CONTENT_STATE.EXPIRED;\n }\n\n // Determines if the tile's content failed to load. `true` if the tile's\n // content failed to load; otherwise, `false`.\n get contentFailed() {\n return this.contentState === TILE_CONTENT_STATE.FAILED;\n }\n\n /**\n * Distance from the tile's bounding volume center to the camera\n */\n get distanceToCamera(): number {\n return this._distanceToCamera;\n }\n\n /**\n * Screen space error for LOD selection\n */\n get screenSpaceError(): number {\n return this._screenSpaceError;\n }\n\n /**\n * Get bounding box in cartographic coordinates\n * @returns [min, max] each in [longitude, latitude, altitude]\n */\n get boundingBox(): CartographicBounds {\n if (!this._boundingBox) {\n this._boundingBox = getCartographicBounds(this.header.boundingVolume, this.boundingVolume);\n }\n return this._boundingBox;\n }\n\n /** Get the tile's screen space error. */\n getScreenSpaceError(frameState, useParentLodMetric) {\n switch (this.tileset.type) {\n case TILESET_TYPE.I3S:\n return getProjectedRadius(this, frameState);\n case TILESET_TYPE.TILES3D:\n return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);\n default:\n // eslint-disable-next-line\n throw new Error('Unsupported tileset type');\n }\n }\n\n /**\n * Make tile unselected than means it won't be shown\n * but it can be still loaded in memory\n */\n unselect(): void {\n this._selectedFrame = 0;\n }\n\n /*\n * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.\n * Tiles are prioritized by screen space error.\n */\n // eslint-disable-next-line complexity\n _getPriority() {\n const traverser = this.tileset._traverser;\n const {skipLevelOfDetail} = traverser.options;\n\n /*\n * Tiles that are outside of the camera's frustum could be skipped if we are in 'ADD' mode\n * or if we are using 'Skip Traversal' in 'REPLACE' mode.\n * Otherewise, all 'touched' child tiles have to be loaded and displayed,\n * this may include tiles that are outide of the camera frustum (so that we can hide the parent tile).\n */\n const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;\n\n // Check if any reason to abort\n if (maySkipTile && !this.isVisible && this._visible !== undefined) {\n return -1;\n }\n // Condition used in `cancelOutOfViewRequests` function in CesiumJS/Cesium3DTileset.js\n if (this.tileset._frameNumber - this._touchedFrame >= 1) {\n return -1;\n }\n if (this.contentState === TILE_CONTENT_STATE.UNLOADED) {\n return -1;\n }\n\n // Based on the priority function `getPriorityReverseScreenSpaceError` in CesiumJS. Scheduling priority is based on the parent's screen space error when possible.\n const parent = this.parent;\n const useParentScreenSpaceError =\n parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);\n const screenSpaceError = useParentScreenSpaceError\n ? parent._screenSpaceError\n : this._screenSpaceError;\n\n const rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;\n\n // Map higher SSE to lower values (e.g. root tile is highest priority)\n return Math.max(rootScreenSpaceError - screenSpaceError, 0);\n }\n\n /**\n * Requests the tile's content.\n * The request may not be made if the Request Scheduler can't prioritize it.\n */\n // eslint-disable-next-line max-statements, complexity\n async loadContent(): Promise<boolean> {\n if (this.hasEmptyContent) {\n return false;\n }\n\n if (this.content) {\n return true;\n }\n\n const expired = this.contentExpired;\n\n if (expired) {\n this._expireDate = null;\n }\n\n this.contentState = TILE_CONTENT_STATE.LOADING;\n\n const requestToken = await this.tileset._requestScheduler.scheduleRequest(\n this.id,\n this._getPriority.bind(this)\n );\n\n if (!requestToken) {\n // cancelled\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return false;\n }\n\n try {\n const contentUrl = this.tileset.getTileUrl(this.contentUrl);\n // The content can be a binary tile ot a JSON tileset\n const loader = this.tileset.loader;\n const options = {\n ...this.tileset.loadOptions,\n [loader.id]: {\n ...this.tileset.loadOptions[loader.id],\n isTileset: this.type === 'json',\n ...this._getLoaderSpecificOptions(loader.id)\n }\n };\n\n this.content = await load(contentUrl, loader, options);\n\n if (this.tileset.options.contentLoader) {\n await this.tileset.options.contentLoader(this);\n }\n\n if (this._isTileset()) {\n // Add tile headers for the nested tilset's subtree\n // Async update of the tree should be fine since there would never be edits to the same node\n // TODO - we need to capture the child tileset's URL\n this.tileset._initializeTileHeaders(this.content, this);\n }\n\n this.contentState = TILE_CONTENT_STATE.READY;\n this._onContentLoaded();\n return true;\n } catch (error) {\n // Tile is unloaded before the content finishes loading\n this.contentState = TILE_CONTENT_STATE.FAILED;\n throw error;\n } finally {\n requestToken.done();\n }\n }\n\n // Unloads the tile's content.\n unloadContent() {\n if (this.content && this.content.destroy) {\n this.content.destroy();\n }\n this.content = null;\n if (this.header.content && this.header.content.destroy) {\n this.header.content.destroy();\n }\n this.header.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return true;\n }\n\n /**\n * Update the tile's visibility\n * @param {Object} frameState - frame state for tile culling\n * @param {string[]} viewportIds - a list of viewport ids that show this tile\n * @return {void}\n */\n updateVisibility(frameState, viewportIds) {\n if (this._frameNumber === frameState.frameNumber) {\n // Return early if visibility has already been checked during the traversal.\n // The visibility may have already been checked if the cullWithChildrenBounds optimization is used.\n return;\n }\n\n const parent = this.parent;\n const parentVisibilityPlaneMask = parent\n ? parent._visibilityPlaneMask\n : CullingVolume.MASK_INDETERMINATE;\n\n if (this.tileset._traverser.options.updateTransforms) {\n const parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;\n this._updateTransform(parentTransform);\n }\n\n this._distanceToCamera = this.distanceToTile(frameState);\n this._screenSpaceError = this.getScreenSpaceError(frameState, false);\n this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask); // Use parent's plane mask to speed up visibility test\n this._visible = this._visibilityPlaneMask !== CullingVolume.MASK_OUTSIDE;\n this._inRequestVolume = this.insideViewerRequestVolume(frameState);\n\n this._frameNumber = frameState.frameNumber;\n this.viewportIds = viewportIds;\n }\n\n // Determines whether the tile's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check.\n // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}.\n visibility(frameState, parentVisibilityPlaneMask) {\n const {cullingVolume} = frameState;\n const {boundingVolume} = this;\n\n // TODO Cesium specific - restore clippingPlanes\n // const {clippingPlanes, clippingPlanesOriginMatrix} = tileset;\n // if (clippingPlanes && clippingPlanes.enabled) {\n // const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n // boundingVolume,\n // clippingPlanesOriginMatrix\n // );\n // this._isClipped = intersection !== Intersect.INSIDE;\n // if (intersection === Intersect.OUTSIDE) {\n // return CullingVolume.MASK_OUTSIDE;\n // }\n // }\n\n // return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n }\n\n // Assuming the tile's bounding volume intersects the culling volume, determines\n // whether the tile's content's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume.\n contentVisibility() {\n return true;\n\n // TODO restore\n /*\n // Assumes the tile's bounding volume intersects the culling volume already, so\n // just return Intersect.INSIDE if there is no content bounding volume.\n if (!defined(this.contentBoundingVolume)) {\n return Intersect.INSIDE;\n }\n\n if (this._visibilityPlaneMask === CullingVolume.MASK_INSIDE) {\n // The tile's bounding volume is completely inside the culling volume so\n // the content bounding volume must also be inside.\n return Intersect.INSIDE;\n }\n\n // PERFORMANCE_IDEA: is it possible to burn less CPU on this test since we know the\n // tile's (not the content's) bounding volume intersects the culling volume?\n const cullingVolume = frameState.cullingVolume;\n const boundingVolume = tile.contentBoundingVolume;\n\n const tileset = this.tileset;\n const clippingPlanes = tileset.clippingPlanes;\n if (defined(clippingPlanes) && clippingPlanes.enabled) {\n const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n boundingVolume,\n tileset.clippingPlanesOriginMatrix\n );\n this._isClipped = intersection !== Intersect.INSIDE;\n if (intersection === Intersect.OUTSIDE) {\n return Intersect.OUTSIDE;\n }\n }\n\n return cullingVolume.computeVisibility(boundingVolume);\n */\n }\n\n /**\n * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.\n * @param frameState The frame state.\n * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.\n */\n distanceToTile(frameState: FrameState): number {\n const boundingVolume = this.boundingVolume;\n return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));\n }\n\n /**\n * Computes the tile's camera-space z-depth.\n * @param frameState The frame state.\n * @returns The distance, in meters.\n */\n cameraSpaceZDepth({camera}): number {\n const boundingVolume = this.boundingVolume; // Gets the underlying OrientedBoundingBox or BoundingSphere\n scratchVector.subVectors(boundingVolume.center, camera.position);\n return camera.direction.dot(scratchVector);\n }\n\n /**\n * Checks if the camera is inside the viewer request volume.\n * @param {FrameState} frameState The frame state.\n * @returns {Boolean} Whether the camera is inside the volume.\n */\n insideViewerRequestVolume(frameState: FrameState) {\n const viewerRequestVolume = this._viewerRequestVolume;\n return (\n !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0\n );\n }\n\n // TODO Cesium specific\n\n // Update whether the tile has expired.\n updateExpiration() {\n if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {\n const now = Date.now();\n // @ts-ignore Date.lessThan - replace with ms compare?\n if (Date.lessThan(this._expireDate, now)) {\n this.contentState = TILE_CONTENT_STATE.EXPIRED;\n this._expiredContent = this.content;\n }\n }\n }\n\n get extras() {\n return this.header.extras;\n }\n\n // INTERNAL METHODS\n\n _initializeLodMetric(header) {\n if ('lodMetricType' in header) {\n this.lodMetricType = header.lodMetricType;\n } else {\n this.lodMetricType = (this.parent && this.parent.lodMetricType) || this.tileset.lodMetricType;\n // eslint-disable-next-line\n console.warn(`3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType`);\n }\n\n // This is used to compute screen space error, i.e., the error measured in pixels.\n if ('lodMetricValue' in header) {\n this.lodMetricValue = header.lodMetricValue;\n } else {\n this.lodMetricValue =\n (this.parent && this.parent.lodMetricValue) || this.tileset.lodMetricValue;\n // eslint-disable-next-line\n console.warn(\n '3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue'\n );\n }\n }\n\n _initializeTransforms(tileHeader) {\n // The local transform of this tile.\n this.transform = tileHeader.transform ? new Matrix4(tileHeader.transform) : new Matrix4();\n\n const parent = this.parent;\n const tileset = this.tileset;\n\n const parentTransform =\n parent && parent.computedTransform\n ? parent.computedTransform.clone()\n : tileset.modelMatrix.clone();\n this.computedTransform = new Matrix4(parentTransform).multiplyRight(this.transform);\n\n const parentInitialTransform =\n parent && parent._initialTransform ? parent._initialTransform.clone() : new Matrix4();\n this._initialTransform = new Matrix4(parentInitialTransform).multiplyRight(this.transform);\n }\n\n _initializeBoundingVolumes(tileHeader) {\n this._contentBoundingVolume = null;\n this._viewerRequestVolume = null;\n\n this._updateBoundingVolume(tileHeader);\n }\n\n _initializeContent(tileHeader) {\n // Empty tile by default\n this.content = {_tileset: this.tileset, _tile: this};\n this.hasEmptyContent = true;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n\n // When `true`, the tile's content points to an external tileset.\n // This is `false` until the tile's content is loaded.\n this.hasTilesetContent = false;\n\n if (tileHeader.contentUrl) {\n this.content = null;\n this.hasEmptyContent = false;\n }\n }\n\n // TODO - remove anything not related to basic visibility detection\n _initializeRenderingState(header) {\n this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);\n this._shouldRefine = false;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._screenSpaceError = 0;\n this._visibilityPlaneMask = CullingVolume.MASK_INDETERMINATE;\n this._visible = undefined;\n this._inRequestVolume = false;\n\n this._stackLength = 0;\n this._selectionDepth = 0;\n\n this._frameNumber = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n\n this._priority = 0.0;\n }\n\n _getRefine(refine) {\n // Inherit from parent tile if omitted.\n return refine || (this.parent && this.parent.refine) || TILE_REFINEMENT.REPLACE;\n }\n\n _isTileset() {\n return this.contentUrl.indexOf('.json') !== -1;\n }\n\n _onContentLoaded() {\n // Vector and Geometry tile rendering do not support the skip LOD optimization.\n switch (this.content && this.content.type) {\n case 'vctr':\n case 'geom':\n // @ts-ignore\n this.tileset._traverser.disableSkipLevelOfDetail = true;\n break;\n default:\n }\n\n // The content may be tileset json\n if (this._isTileset()) {\n this.hasTilesetContent = true;\n }\n }\n\n _updateBoundingVolume(header) {\n // Update the bounding volumes\n this.boundingVolume = createBoundingVolume(\n header.boundingVolume,\n this.computedTransform,\n this.boundingVolume\n );\n\n const content = header.content;\n if (!content) {\n return;\n }\n\n // TODO Cesium specific\n // Non-leaf tiles may have a content bounding-volume, which is a tight-fit bounding volume\n // around only the features in the tile. This box is useful for culling for rendering,\n // but not for culling for traversing the tree since it does not guarantee spatial coherence, i.e.,\n // since it only bounds features in the tile, not the entire tile, children may be\n // outside of this box.\n if (content.boundingVolume) {\n this._contentBoundingVolume = createBoundingVolume(\n content.boundingVolume,\n this.computedTransform,\n this._contentBoundingVolume\n );\n }\n if (header.viewerRequestVolume) {\n this._viewerRequestVolume = createBoundingVolume(\n header.viewerRequestVolume,\n this.computedTransform,\n this._viewerRequestVolume\n );\n }\n }\n\n // Update the tile's transform. The transform is applied to the tile's bounding volumes.\n _updateTransform(parentTransform = new Matrix4()) {\n const computedTransform = parentTransform.clone().multiplyRight(this.transform);\n const didTransformChange = !computedTransform.equals(this.computedTransform);\n\n if (!didTransformChange) {\n return;\n }\n\n this.computedTransform = computedTransform;\n\n this._updateBoundingVolume(this.header);\n }\n\n // Get options which are applicable only for the particular loader\n _getLoaderSpecificOptions(loaderId) {\n switch (loaderId) {\n case 'i3s':\n return {\n ...this.tileset.options.i3s,\n _tileOptions: {\n attributeUrls: this.header.attributeUrls,\n textureUrl: this.header.textureUrl,\n textureFormat: this.header.textureFormat,\n textureLoaderOptions: this.header.textureLoaderOptions,\n materialDefinition: this.header.materialDefinition,\n isDracoGeometry: this.header.isDracoGeometry,\n mbs: this.header.mbs\n },\n _tilesetOptions: {\n store: this.tileset.tileset.store,\n attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,\n fields: this.tileset.tileset.fields\n },\n isTileHeader: false\n };\n case '3d-tiles':\n case 'cesium-ion':\n default:\n return get3dTilesOptions(this.tileset.tileset);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAKA;AACA;AAEA;AAIA;AAGA;AAKA;AACA;AACA;AACA;AAAqD;AAAA;AAErD,IAAMA,aAAa,GAAG,IAAIC,aAAO,EAAE;AAEnC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