@loaders.gl/3d-tiles 4.3.0-alpha.7 → 4.3.0-beta.1
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/3d-tiles-archive/3d-tiles-archive-parser.d.ts +1 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts.map +1 -1
- package/dist/3d-tiles-archive-loader.d.ts.map +1 -1
- package/dist/3d-tiles-archive-loader.js +1 -1
- package/dist/cesium-ion-loader.d.ts +1 -1
- package/dist/dist.dev.js +12366 -13385
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +71 -71
- package/dist/index.cjs.map +2 -2
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -1
- package/dist/lib/classes/tile-3d-batch-table.d.ts +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +35 -19
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +109 -86
- package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -1
- package/dist/lib/utils/obb/s2-corners-to-obb.js +1 -2
- package/dist/lib/utils/version.js +1 -1
- package/dist/tile-3d-subtree-loader.d.ts.map +1 -1
- package/dist/tiles-3d-loader.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +131 -117
- package/src/lib/utils/obb/s2-corners-to-obb.ts +1 -2
|
@@ -21,7 +21,7 @@ export default class Tile3DBatchTableParser {
|
|
|
21
21
|
_setBinaryProperty(binaryProperty: any, index: any, value: any): void;
|
|
22
22
|
_initializeBinaryProperties(): Record<string, any> | null;
|
|
23
23
|
_initializeBinaryProperty(name: any, property: any): {
|
|
24
|
-
typedArray: import("@math.gl/
|
|
24
|
+
typedArray: import("@math.gl/types").TypedArray;
|
|
25
25
|
componentCount: any;
|
|
26
26
|
unpack: any;
|
|
27
27
|
pack: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Subtree } from "../../../types.js";
|
|
1
|
+
import type { Tile3DBoundingVolume, Subtree } from "../../../types.js";
|
|
2
2
|
import type { S2VolumeInfo } from "../../utils/obb/s2-corners-to-obb.js";
|
|
3
3
|
import { Tiles3DLoaderOptions } from "../../../tiles-3d-loader.js";
|
|
4
4
|
import { ImplicitOptions } from "../parse-3d-tile-header.js";
|
|
@@ -15,38 +15,54 @@ export type S2VolumeBox = {
|
|
|
15
15
|
* Recursively parse implicit tiles tree
|
|
16
16
|
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling
|
|
17
17
|
* TODO Check out do we able to use Tile3D class as return type here.
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
*
|
|
24
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* @param subtree - the current subtree. Subtrees contain availability data for <implicitOptions.subtreeLevels>.
|
|
20
|
+
* Once we go deeper than that many levels, we will need load a child subtree to get further availability data.
|
|
21
|
+
* @param subtreeData - the coordinates of the current subtree, relative to the root of this implicit tiles tree.
|
|
22
|
+
* @param parentData - the coordinates of the parent tile, relative to the current subtree.
|
|
23
|
+
* The overall coordinates of the current tile can be found by combining the coordinates of the current subtree, the parent tile,
|
|
24
|
+
* and tje single-bit coordinates that can be calculated from the childIndex.
|
|
25
|
+
* @param childIndex - which child the current tile is of its parent. In the range 0-7 for OCTREE, 0-3 for QUADTREE.
|
|
26
|
+
* @param implicitOptions - options specified at the root of this implicit tile tree - numbers of levels, URL templates.
|
|
27
|
+
* @param loaderOptions - see Tiles3DLoaderOptions.
|
|
25
28
|
*/
|
|
26
29
|
export declare function parseImplicitTiles(params: {
|
|
27
30
|
subtree: Subtree;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
mortonIndex: number;
|
|
31
|
+
subtreeData?: {
|
|
32
|
+
level: number;
|
|
31
33
|
x: number;
|
|
32
34
|
y: number;
|
|
33
35
|
z: number;
|
|
34
36
|
};
|
|
35
|
-
|
|
36
|
-
level?: number;
|
|
37
|
-
globalData?: {
|
|
38
|
-
level: number;
|
|
37
|
+
parentData?: {
|
|
39
38
|
mortonIndex: number;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
localLevel: number;
|
|
40
|
+
localX: number;
|
|
41
|
+
localY: number;
|
|
42
|
+
localZ: number;
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
childIndex?: number;
|
|
45
|
+
implicitOptions: ImplicitOptions;
|
|
45
46
|
loaderOptions: Tiles3DLoaderOptions;
|
|
47
|
+
s2VolumeBox?: S2VolumeBox;
|
|
46
48
|
}): Promise<{
|
|
47
49
|
children: never[];
|
|
48
50
|
lodMetricValue: number;
|
|
49
51
|
contentUrl: string;
|
|
52
|
+
} | {
|
|
53
|
+
children: any;
|
|
54
|
+
contentUrl: any;
|
|
55
|
+
content: {
|
|
56
|
+
uri: any;
|
|
57
|
+
};
|
|
58
|
+
id: any;
|
|
59
|
+
refine: string | import("@loaders.gl/tiles").TILE_REFINEMENT | undefined;
|
|
60
|
+
type: string;
|
|
61
|
+
lodMetricType: import("@loaders.gl/tiles").LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
62
|
+
lodMetricValue: number;
|
|
63
|
+
geometricError: number;
|
|
64
|
+
transform: any;
|
|
65
|
+
boundingVolume: Tile3DBoundingVolume;
|
|
50
66
|
}>;
|
|
51
67
|
/**
|
|
52
68
|
* Replace implicit tile content url with real coordinates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-implicit-tiles.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"parse-3d-implicit-tiles.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAe,oBAAoB,EAAE,OAAO,EAAC,0BAAuB;AAMhF,OAAO,KAAK,EAAC,YAAY,EAAC,6CAA0C;AAGpE,OAAO,EAAC,oBAAoB,EAAC,oCAAiC;AAC9D,OAAO,EAAC,eAAe,EAAC,mCAAgC;AAUxD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,yFAAyF;IACzF,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,uGAAuG;IACvG,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AA6CF;;;;;;;;;;;;;;GAcG;AAEH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC/D,UAAU,CAAC,EAAE;QACX,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,EAAE,oBAAoB,CAAC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;;;;;;;;;;;;;;;;;;GAuJA;AA0JD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,MAAM,CAGR"}
|
|
@@ -52,109 +52,122 @@ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
|
|
|
52
52
|
* Recursively parse implicit tiles tree
|
|
53
53
|
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling
|
|
54
54
|
* TODO Check out do we able to use Tile3D class as return type here.
|
|
55
|
-
*
|
|
56
|
-
* @param
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
*
|
|
61
|
-
*
|
|
55
|
+
*
|
|
56
|
+
* @param subtree - the current subtree. Subtrees contain availability data for <implicitOptions.subtreeLevels>.
|
|
57
|
+
* Once we go deeper than that many levels, we will need load a child subtree to get further availability data.
|
|
58
|
+
* @param subtreeData - the coordinates of the current subtree, relative to the root of this implicit tiles tree.
|
|
59
|
+
* @param parentData - the coordinates of the parent tile, relative to the current subtree.
|
|
60
|
+
* The overall coordinates of the current tile can be found by combining the coordinates of the current subtree, the parent tile,
|
|
61
|
+
* and tje single-bit coordinates that can be calculated from the childIndex.
|
|
62
|
+
* @param childIndex - which child the current tile is of its parent. In the range 0-7 for OCTREE, 0-3 for QUADTREE.
|
|
63
|
+
* @param implicitOptions - options specified at the root of this implicit tile tree - numbers of levels, URL templates.
|
|
64
|
+
* @param loaderOptions - see Tiles3DLoaderOptions.
|
|
62
65
|
*/
|
|
63
|
-
// eslint-disable-next-line max-statements
|
|
66
|
+
// eslint-disable-next-line max-statements, complexity
|
|
64
67
|
export async function parseImplicitTiles(params) {
|
|
65
|
-
const {
|
|
66
|
-
mortonIndex: 0,
|
|
67
|
-
x: 0,
|
|
68
|
-
y: 0,
|
|
69
|
-
z: 0
|
|
70
|
-
}, childIndex = 0, s2VolumeBox, loaderOptions } = params;
|
|
71
|
-
let { subtree, level = 0, globalData = {
|
|
68
|
+
const { subtree, subtreeData = {
|
|
72
69
|
level: 0,
|
|
73
|
-
mortonIndex: 0,
|
|
74
70
|
x: 0,
|
|
75
71
|
y: 0,
|
|
76
72
|
z: 0
|
|
77
|
-
}
|
|
73
|
+
}, parentData = {
|
|
74
|
+
mortonIndex: 0,
|
|
75
|
+
localLevel: -1,
|
|
76
|
+
localX: 0,
|
|
77
|
+
localY: 0,
|
|
78
|
+
localZ: 0
|
|
79
|
+
}, childIndex = 0, implicitOptions, loaderOptions, s2VolumeBox } = params;
|
|
78
80
|
const { subdivisionScheme, subtreeLevels, maximumLevel, contentUrlTemplate, subtreesUriTemplate, basePath } = implicitOptions;
|
|
79
81
|
const tile = { children: [], lodMetricValue: 0, contentUrl: '' };
|
|
80
82
|
if (!maximumLevel) {
|
|
81
83
|
log.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
|
|
82
84
|
return tile;
|
|
83
85
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
// Local tile level - relative to the current subtree.
|
|
87
|
+
const localLevel = parentData.localLevel + 1;
|
|
88
|
+
// Global tile level - relative to the root tile of this implicit subdivision scheme.
|
|
89
|
+
const level = subtreeData.level + localLevel;
|
|
90
|
+
if (level > maximumLevel) {
|
|
86
91
|
return tile;
|
|
87
92
|
}
|
|
88
93
|
const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];
|
|
89
94
|
const bitsPerTile = Math.log2(childrenPerTile);
|
|
90
|
-
// childIndex is in range
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
95
|
+
// childIndex is in range 0...3 for quadtrees and 0...7 for octrees
|
|
96
|
+
const lastBitX = childIndex & 0b01; // Get first bit for X
|
|
97
|
+
const lastBitY = (childIndex >> 1) & 0b01; // Get second bit for Y
|
|
98
|
+
const lastBitZ = (childIndex >> 2) & 0b01; // Get third bit for Z
|
|
99
|
+
// Local tile coordinates - relative to the current subtree root.
|
|
100
|
+
const localX = concatBits(parentData.localX, lastBitX, 1);
|
|
101
|
+
const localY = concatBits(parentData.localY, lastBitY, 1);
|
|
102
|
+
const localZ = concatBits(parentData.localZ, lastBitZ, 1);
|
|
103
|
+
// Global tile coordinates - relative to the implicit-tile-tree root.
|
|
104
|
+
// Found by combining the local coordinates which are relative to the current subtree, with the subtree coordinates.
|
|
105
|
+
const x = concatBits(subtreeData.x, localX, localLevel);
|
|
106
|
+
const y = concatBits(subtreeData.y, localY, localLevel);
|
|
107
|
+
const z = concatBits(subtreeData.z, localZ, localLevel);
|
|
108
|
+
const mortonIndex = concatBits(parentData.mortonIndex, childIndex, bitsPerTile);
|
|
109
|
+
const isChildSubtreeAvailable = localLevel === subtreeLevels &&
|
|
110
|
+
getAvailabilityResult(subtree.childSubtreeAvailability, mortonIndex);
|
|
111
|
+
// Context to provide the next recursive call.
|
|
112
|
+
// This context is set up differently depending on whether its time to start a new subtree or not.
|
|
113
|
+
let nextSubtree;
|
|
114
|
+
let nextSubtreeData;
|
|
115
|
+
let nextParentData;
|
|
116
|
+
let tileAvailabilityIndex;
|
|
108
117
|
if (isChildSubtreeAvailable) {
|
|
109
118
|
const subtreePath = `${basePath}/${subtreesUriTemplate}`;
|
|
110
|
-
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath,
|
|
119
|
+
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, level, x, y, z);
|
|
111
120
|
const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
|
|
112
|
-
subtree
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
x: childTileX,
|
|
116
|
-
y: childTileY,
|
|
117
|
-
z: childTileZ,
|
|
118
|
-
level
|
|
119
|
-
};
|
|
120
|
-
childTileMortonIndex = 0;
|
|
121
|
+
// The next subtree is the newly-loaded child subtree.
|
|
122
|
+
nextSubtree = childSubtree;
|
|
123
|
+
// The current tile is actually the root tile in the next subtree, so it has a tileAvailabilityIndex of 0.
|
|
121
124
|
tileAvailabilityIndex = 0;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
// The next subtree starts HERE - at the current tile.
|
|
126
|
+
nextSubtreeData = { level, x, y, z };
|
|
127
|
+
// The next parent is also the current tile - so it has local coordinates of 0 relative to the next subtree.
|
|
128
|
+
nextParentData = { mortonIndex: 0, localLevel: 0, localX: 0, localY: 0, localZ: 0 };
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Continue on with the same subtree as we're using currently.
|
|
132
|
+
nextSubtree = subtree;
|
|
133
|
+
// Calculate a tileAvailabilityIndex for the current tile within the current subtree.
|
|
134
|
+
const levelOffset = (childrenPerTile ** localLevel - 1) / (childrenPerTile - 1);
|
|
135
|
+
tileAvailabilityIndex = levelOffset + mortonIndex;
|
|
136
|
+
// The next subtree is the same as the current subtree.
|
|
137
|
+
nextSubtreeData = subtreeData;
|
|
138
|
+
// The next parent is the current tile: it has the local coordinates we already calculated.
|
|
139
|
+
nextParentData = { mortonIndex, localLevel, localX, localY, localZ };
|
|
126
140
|
}
|
|
127
|
-
const isTileAvailable = getAvailabilityResult(
|
|
141
|
+
const isTileAvailable = getAvailabilityResult(nextSubtree.tileAvailability, tileAvailabilityIndex);
|
|
128
142
|
if (!isTileAvailable) {
|
|
129
143
|
return tile;
|
|
130
144
|
}
|
|
131
|
-
const isContentAvailable = getAvailabilityResult(
|
|
145
|
+
const isContentAvailable = getAvailabilityResult(nextSubtree.contentAvailability, tileAvailabilityIndex);
|
|
132
146
|
if (isContentAvailable) {
|
|
133
|
-
tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate,
|
|
147
|
+
tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, level, x, y, z);
|
|
134
148
|
}
|
|
135
|
-
const childTileLevel = level + 1;
|
|
136
|
-
const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
|
|
137
149
|
for (let index = 0; index < childrenPerTile; index++) {
|
|
138
150
|
const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
|
|
139
151
|
// Recursive calling...
|
|
140
|
-
const
|
|
141
|
-
subtree,
|
|
152
|
+
const childTile = await parseImplicitTiles({
|
|
153
|
+
subtree: nextSubtree,
|
|
154
|
+
subtreeData: nextSubtreeData,
|
|
155
|
+
parentData: nextParentData,
|
|
156
|
+
childIndex: index,
|
|
142
157
|
implicitOptions,
|
|
143
158
|
loaderOptions,
|
|
144
|
-
parentData: pData,
|
|
145
|
-
childIndex: index,
|
|
146
|
-
level: childTileLevel,
|
|
147
|
-
globalData: { ...globalData },
|
|
148
159
|
s2VolumeBox: childS2VolumeBox
|
|
149
160
|
});
|
|
150
|
-
if (
|
|
151
|
-
const globalLevel = lev + 1;
|
|
152
|
-
const childCoordinates = { childTileX, childTileY, childTileZ };
|
|
153
|
-
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
|
|
161
|
+
if (childTile.contentUrl || childTile.children.length) {
|
|
154
162
|
// @ts-ignore
|
|
155
|
-
tile.children.push(
|
|
163
|
+
tile.children.push(childTile);
|
|
156
164
|
}
|
|
157
165
|
}
|
|
166
|
+
if (tile.contentUrl || tile.children.length) {
|
|
167
|
+
const coordinates = { level, x, y, z };
|
|
168
|
+
const formattedTile = formatTileData(tile, coordinates, implicitOptions, s2VolumeBox);
|
|
169
|
+
return formattedTile;
|
|
170
|
+
}
|
|
158
171
|
return tile;
|
|
159
172
|
}
|
|
160
173
|
/**
|
|
@@ -190,19 +203,21 @@ function getAvailabilityResult(availabilityData, index) {
|
|
|
190
203
|
/**
|
|
191
204
|
* Do formatting of implicit tile data.
|
|
192
205
|
* TODO Check out do we able to use Tile3D class as type here.
|
|
193
|
-
*
|
|
194
|
-
* @param
|
|
195
|
-
* @param
|
|
206
|
+
*
|
|
207
|
+
* @param tile - tile data to format.
|
|
208
|
+
* @param coordinates - global tile coordinates (relative to the root of the implicit tile tree).
|
|
209
|
+
* @param options - options specified at the root of this implicit tile tree - numbers of levels, URL templates.
|
|
210
|
+
* @param s2VolumeBox - the S2VolumeBox for this particular child, if available.
|
|
196
211
|
* @returns
|
|
197
212
|
*/
|
|
198
|
-
function formatTileData(tile,
|
|
213
|
+
function formatTileData(tile, coordinates, options, s2VolumeBox) {
|
|
199
214
|
const { basePath, refine, getRefine, lodMetricType, getTileType, rootLodMetricValue, rootBoundingVolume } = options;
|
|
200
215
|
const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, '');
|
|
201
|
-
const lodMetricValue = rootLodMetricValue / 2 ** level;
|
|
216
|
+
const lodMetricValue = rootLodMetricValue / 2 ** coordinates.level;
|
|
202
217
|
const boundingVolume = s2VolumeBox?.box
|
|
203
218
|
? { box: s2VolumeBox.box }
|
|
204
219
|
: rootBoundingVolume;
|
|
205
|
-
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(
|
|
220
|
+
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(boundingVolume, coordinates, options.subdivisionScheme);
|
|
206
221
|
return {
|
|
207
222
|
children: tile.children,
|
|
208
223
|
contentUrl: tile.contentUrl,
|
|
@@ -220,28 +235,36 @@ function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
|
|
|
220
235
|
/**
|
|
221
236
|
* Calculate child bounding volume.
|
|
222
237
|
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-rules
|
|
223
|
-
* @param level
|
|
224
238
|
* @param rootBoundingVolume
|
|
225
|
-
* @param
|
|
239
|
+
* @param coordinates
|
|
240
|
+
* @param subdivisionScheme
|
|
226
241
|
*/
|
|
227
|
-
function calculateBoundingVolumeForChildTile(
|
|
242
|
+
function calculateBoundingVolumeForChildTile(rootBoundingVolume, coordinates, subdivisionScheme) {
|
|
228
243
|
if (rootBoundingVolume.region) {
|
|
229
|
-
const {
|
|
244
|
+
const { level, x, y, z } = coordinates;
|
|
230
245
|
const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;
|
|
231
246
|
const boundingVolumesCount = 2 ** level;
|
|
232
247
|
const sizeX = (east - west) / boundingVolumesCount;
|
|
248
|
+
const [childWest, childEast] = [west + sizeX * x, west + sizeX * (x + 1)];
|
|
233
249
|
const sizeY = (north - south) / boundingVolumesCount;
|
|
234
|
-
|
|
250
|
+
const [childSouth, childNorth] = [south + sizeY * y, south + sizeY * (y + 1)];
|
|
235
251
|
// In case of QUADTREE the sizeZ should NOT be changed!
|
|
236
252
|
// https://portal.ogc.org/files/102132
|
|
237
|
-
// A quadtree divides space only on the x and y dimensions.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
253
|
+
// A quadtree divides space only on the x and y dimensions.
|
|
254
|
+
// It divides each tile into 4 smaller tiles where the x and y dimensions are halved.
|
|
255
|
+
// The quadtree z minimum and maximum remain unchanged.
|
|
256
|
+
let childMinimumHeight;
|
|
257
|
+
let childMaximumHeight;
|
|
258
|
+
if (subdivisionScheme === 'OCTREE') {
|
|
259
|
+
const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;
|
|
260
|
+
[childMinimumHeight, childMaximumHeight] = [
|
|
261
|
+
minimumHeight + sizeZ * z,
|
|
262
|
+
minimumHeight + sizeZ * (z + 1)
|
|
263
|
+
];
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
[childMinimumHeight, childMaximumHeight] = [minimumHeight, maximumHeight];
|
|
267
|
+
}
|
|
245
268
|
return {
|
|
246
269
|
region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
|
|
247
270
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s2-corners-to-obb.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/obb/s2-corners-to-obb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"s2-corners-to-obb.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/obb/s2-corners-to-obb.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,YAAY,GAAG;IACzB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,EAAE,CA2BjF"}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
import { Vector3 } from '@math.gl/core';
|
|
5
5
|
import { makeOrientedBoundingBoxFromPoints } from '@math.gl/culling';
|
|
6
|
-
import { getS2OrientedBoundingBoxCornerPoints } from "../../utils/s2/index.js";
|
|
7
|
-
import { getS2LngLat } from "../../utils/s2/index.js";
|
|
6
|
+
import { getS2OrientedBoundingBoxCornerPoints, getS2LngLat } from "../../utils/s2/index.js";
|
|
8
7
|
import { Ellipsoid } from '@math.gl/geospatial';
|
|
9
8
|
/**
|
|
10
9
|
* Converts S2VolumeInfo to OrientedBoundingBox
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
2
2
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
3
3
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
4
|
-
export const VERSION = typeof "4.3.0-alpha.
|
|
4
|
+
export const VERSION = typeof "4.3.0-alpha.8" !== 'undefined' ? "4.3.0-alpha.8" : 'latest';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-3d-subtree-loader.d.ts","sourceRoot":"","sources":["../src/tile-3d-subtree-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAC,mBAAgB;AACrC,OAAO,mBAAmB,uDAAoD;AAG9E;;GAEG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"tile-3d-subtree-loader.d.ts","sourceRoot":"","sources":["../src/tile-3d-subtree-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAC,mBAAgB;AACrC,OAAO,mBAAmB,uDAAoD;AAG9E;;GAEG;AACH,eAAO,MAAM,mBAAmB;uBACD,OAAO;wBACjB,KAAK;;;;;;;;;;CAU0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiles-3d-loader.d.ts","sourceRoot":"","sources":["../src/tiles-3d-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE7F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAO3D,OAAO,EAAqB,kBAAkB,EAAE,+BAA+B,EAAC,mBAAgB;AAEhG,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAE9C,kBAAkB,GAClB,kBAAkB,GAAG;IACnB,UAAU,CAAC,EAAE;QACX,mGAAmG;QACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,qFAAqF;QACrF,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,0CAA0C;QAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC7B,gDAAgD;QAChD,eAAe,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;KAC1C,CAAC;CACH,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"tiles-3d-loader.d.ts","sourceRoot":"","sources":["../src/tiles-3d-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE7F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAO3D,OAAO,EAAqB,kBAAkB,EAAE,+BAA+B,EAAC,mBAAgB;AAEhG,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAE9C,kBAAkB,GAClB,kBAAkB,GAAG;IACnB,UAAU,CAAC,EAAE;QACX,mGAAmG;QACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,qFAAqF;QACrF,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,0CAA0C;QAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC7B,gDAAgD;QAChD,eAAe,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;KAC1C,CAAC;CACH,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,aAAa;uBACN,GAAG;wBACF,KAAK;;;;;;;;;;;;;;;;;CAqBzB,CAAC;AAEF,+BAA+B;AAC/B,iBAAe,KAAK,CAClB,IAAI,KAAA,EACJ,OAAO,GAAE,oBAAyB,EAClC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,kBAAkB,GAAG,+BAA+B,CAAC,CAW/D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/3d-tiles",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-beta.1",
|
|
4
4
|
"description": "3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,23 +46,23 @@
|
|
|
46
46
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@loaders.gl/compression": "4.3.0-
|
|
50
|
-
"@loaders.gl/crypto": "4.3.0-
|
|
51
|
-
"@loaders.gl/draco": "4.3.0-
|
|
52
|
-
"@loaders.gl/gltf": "4.3.0-
|
|
53
|
-
"@loaders.gl/images": "4.3.0-
|
|
54
|
-
"@loaders.gl/loader-utils": "4.3.0-
|
|
55
|
-
"@loaders.gl/math": "4.3.0-
|
|
56
|
-
"@loaders.gl/tiles": "4.3.0-
|
|
57
|
-
"@loaders.gl/zip": "4.3.0-
|
|
58
|
-
"@math.gl/core": "^4.0
|
|
59
|
-
"@math.gl/culling": "^4.0
|
|
60
|
-
"@math.gl/geospatial": "^4.0
|
|
49
|
+
"@loaders.gl/compression": "4.3.0-beta.1",
|
|
50
|
+
"@loaders.gl/crypto": "4.3.0-beta.1",
|
|
51
|
+
"@loaders.gl/draco": "4.3.0-beta.1",
|
|
52
|
+
"@loaders.gl/gltf": "4.3.0-beta.1",
|
|
53
|
+
"@loaders.gl/images": "4.3.0-beta.1",
|
|
54
|
+
"@loaders.gl/loader-utils": "4.3.0-beta.1",
|
|
55
|
+
"@loaders.gl/math": "4.3.0-beta.1",
|
|
56
|
+
"@loaders.gl/tiles": "4.3.0-beta.1",
|
|
57
|
+
"@loaders.gl/zip": "4.3.0-beta.1",
|
|
58
|
+
"@math.gl/core": "^4.1.0",
|
|
59
|
+
"@math.gl/culling": "^4.1.0",
|
|
60
|
+
"@math.gl/geospatial": "^4.1.0",
|
|
61
61
|
"@probe.gl/log": "^4.0.4",
|
|
62
62
|
"long": "^5.2.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@loaders.gl/core": "^4.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "992d24e7d4e3015a91fa1cbfe87ee7dc1b333322"
|
|
68
68
|
}
|