@loaders.gl/3d-tiles 4.0.0-alpha.13 → 4.0.0-alpha.15
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 +35 -23
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +49 -34
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +12 -11
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +31 -19
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +6 -4
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +4 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +33 -22
- package/dist/lib/parsers/parse-3d-tile-header.d.ts +30 -2
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +6 -5
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +43 -25
- package/src/lib/parsers/parse-3d-tile-header.ts +37 -5
- package/src/types.ts +4 -0
|
@@ -6,6 +6,7 @@ import {LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE} from '@loaders.gl/tiles';
|
|
|
6
6
|
import {
|
|
7
7
|
ImplicitTilingExensionData,
|
|
8
8
|
Subtree,
|
|
9
|
+
Tile3DBoundingVolume,
|
|
9
10
|
Tiles3DTileContentJSON,
|
|
10
11
|
Tiles3DTileJSON,
|
|
11
12
|
Tiles3DTileJSONPostprocessed,
|
|
@@ -16,6 +17,34 @@ import {parseImplicitTiles, replaceContentUrlTemplate} from './helpers/parse-3d-
|
|
|
16
17
|
import type {S2VolumeInfo} from '../utils/obb/s2-corners-to-obb';
|
|
17
18
|
import {convertS2BoundingVolumetoOBB} from '../utils/obb/s2-corners-to-obb';
|
|
18
19
|
|
|
20
|
+
/** Options for recursive loading implicit subtrees */
|
|
21
|
+
export type ImplicitOptions = {
|
|
22
|
+
/** Template of the full url of the content template */
|
|
23
|
+
contentUrlTemplate: string;
|
|
24
|
+
/** Template of the full url of the subtree */
|
|
25
|
+
subtreesUriTemplate: string;
|
|
26
|
+
/** Implicit subdivision scheme */
|
|
27
|
+
subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;
|
|
28
|
+
/** Levels per subtree */
|
|
29
|
+
subtreeLevels: number;
|
|
30
|
+
/** Maximum implicit level through all subtrees */
|
|
31
|
+
maximumLevel?: number;
|
|
32
|
+
/** 3DTiles refine method (add/replace) */
|
|
33
|
+
refine?: string;
|
|
34
|
+
/** Tileset base path */
|
|
35
|
+
basePath: string;
|
|
36
|
+
/** 3DTiles LOD metric type */
|
|
37
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
38
|
+
/** Root metric value of the root tile of the implicit subtrees */
|
|
39
|
+
rootLodMetricValue: number;
|
|
40
|
+
/** Bounding volume of the root tile of the implicit subtrees */
|
|
41
|
+
rootBoundingVolume: Tile3DBoundingVolume;
|
|
42
|
+
/** Function that detects TILE_TYPE by tile metadata and content URL */
|
|
43
|
+
getTileType: (tile: Tiles3DTileJSON, tileContentUrl?: string) => TILE_TYPE | string;
|
|
44
|
+
/** Function that converts string refine method to enum value */
|
|
45
|
+
getRefine: (refine?: string) => TILE_REFINEMENT | string | undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
19
48
|
function getTileType(tile: Tiles3DTileJSON, tileContentUrl: string = ''): TILE_TYPE | string {
|
|
20
49
|
if (!tileContentUrl) {
|
|
21
50
|
return TILE_TYPE.EMPTY;
|
|
@@ -158,6 +187,7 @@ export async function normalizeImplicitTileHeaders(
|
|
|
158
187
|
const {
|
|
159
188
|
subdivisionScheme,
|
|
160
189
|
maximumLevel,
|
|
190
|
+
availableLevels,
|
|
161
191
|
subtreeLevels,
|
|
162
192
|
subtrees: {uri: subtreesUriTemplate}
|
|
163
193
|
} = implicitTilingExtension;
|
|
@@ -179,12 +209,12 @@ export async function normalizeImplicitTileHeaders(
|
|
|
179
209
|
|
|
180
210
|
const rootBoundingVolume = tile.boundingVolume;
|
|
181
211
|
|
|
182
|
-
const implicitOptions = {
|
|
212
|
+
const implicitOptions: ImplicitOptions = {
|
|
183
213
|
contentUrlTemplate,
|
|
184
214
|
subtreesUriTemplate,
|
|
185
215
|
subdivisionScheme,
|
|
186
216
|
subtreeLevels,
|
|
187
|
-
maximumLevel,
|
|
217
|
+
maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,
|
|
188
218
|
refine,
|
|
189
219
|
basePath,
|
|
190
220
|
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
@@ -194,7 +224,7 @@ export async function normalizeImplicitTileHeaders(
|
|
|
194
224
|
getRefine
|
|
195
225
|
};
|
|
196
226
|
|
|
197
|
-
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
|
|
227
|
+
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);
|
|
198
228
|
}
|
|
199
229
|
|
|
200
230
|
/**
|
|
@@ -208,7 +238,8 @@ export async function normalizeImplicitTileData(
|
|
|
208
238
|
tile: Tiles3DTileJSON,
|
|
209
239
|
basePath: string,
|
|
210
240
|
rootSubtree: Subtree,
|
|
211
|
-
|
|
241
|
+
implicitOptions: ImplicitOptions,
|
|
242
|
+
loaderOptions: Tiles3DLoaderOptions
|
|
212
243
|
): Promise<Tiles3DTileJSONPostprocessed | null> {
|
|
213
244
|
if (!tile) {
|
|
214
245
|
return null;
|
|
@@ -216,7 +247,8 @@ export async function normalizeImplicitTileData(
|
|
|
216
247
|
|
|
217
248
|
const {children, contentUrl} = await parseImplicitTiles({
|
|
218
249
|
subtree: rootSubtree,
|
|
219
|
-
|
|
250
|
+
implicitOptions,
|
|
251
|
+
loaderOptions
|
|
220
252
|
});
|
|
221
253
|
|
|
222
254
|
let tileContentUrl: string | undefined;
|
package/src/types.ts
CHANGED
|
@@ -372,6 +372,10 @@ export type BufferView = {
|
|
|
372
372
|
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling
|
|
373
373
|
*/
|
|
374
374
|
export type ImplicitTilingExensionData = ImplicitTilingData & {
|
|
375
|
+
/** This property is not part of the schema
|
|
376
|
+
* https://github.com/CesiumGS/3d-tiles/blob/main/extensions/3DTILES_implicit_tiling/schema/tile.3DTILES_implicit_tiling.schema.json
|
|
377
|
+
* But it can be seen in some test datasets. It is handled as substitute of `availableLevels`
|
|
378
|
+
*/
|
|
375
379
|
maximumLevel?: number;
|
|
376
380
|
};
|
|
377
381
|
|