@loaders.gl/3d-tiles 3.1.0 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +5 -12159
- package/dist/dist.min.js +12213 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +48 -4
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +6 -4
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +36 -4
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +2 -0
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -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 +36 -5
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +2 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +64 -6
- package/src/lib/parsers/parse-3d-tile-header.ts +2 -0
- package/src/types.ts +2 -1
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,oBAAY,cAAc,GAAG;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,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M,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,cAAc,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,oBAAY,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,mBAAmB,EAAE,YAAY,CAAC;IAClC,wBAAwB,EAAE,YAAY,CAAC;CACxC,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC,CAAC;AAEF,oBAAY,iBAAiB,GAAG,UAAU,CAAC;AAE3C;;GAEG;AACH,oBAAY,iBAAiB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtD,aAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,aAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/3d-tiles",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"pre-build": "npm run build-bundle",
|
|
34
|
-
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/
|
|
34
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@loaders.gl/draco": "3.1.
|
|
38
|
-
"@loaders.gl/gltf": "3.1.
|
|
39
|
-
"@loaders.gl/loader-utils": "3.1.
|
|
40
|
-
"@loaders.gl/math": "3.1.
|
|
41
|
-
"@loaders.gl/tiles": "3.1.
|
|
37
|
+
"@loaders.gl/draco": "3.1.4",
|
|
38
|
+
"@loaders.gl/gltf": "3.1.4",
|
|
39
|
+
"@loaders.gl/loader-utils": "3.1.4",
|
|
40
|
+
"@loaders.gl/math": "3.1.4",
|
|
41
|
+
"@loaders.gl/tiles": "3.1.4",
|
|
42
42
|
"@math.gl/core": "^3.5.1",
|
|
43
43
|
"@math.gl/geospatial": "^3.5.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@loaders.gl/core": "3.1.0
|
|
46
|
+
"@loaders.gl/core": "3.1.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4d27d3ac6023e53b562dcad83b9254b198e81ee5"
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Availability, Subtree} from '../../../types';
|
|
1
|
+
import type {Availability, BoundingVolume, Subtree} from '../../../types';
|
|
2
2
|
import {Tile3DSubtreeLoader} from '../../../tile-3d-subtree-loader';
|
|
3
3
|
import {load} from '@loaders.gl/core';
|
|
4
4
|
|
|
@@ -143,7 +143,8 @@ export async function parseImplicitTiles(
|
|
|
143
143
|
|
|
144
144
|
if (currentTile.contentUrl || currentTile.children.length) {
|
|
145
145
|
const globalLevel = lev + 1;
|
|
146
|
-
const
|
|
146
|
+
const childCoordinates = {childTileX, childTileY, childTileZ};
|
|
147
|
+
const formattedTile = formatTileData(currentTile, globalLevel, childCoordinates, options);
|
|
147
148
|
// @ts-ignore
|
|
148
149
|
tile.children.push(formattedTile);
|
|
149
150
|
}
|
|
@@ -172,11 +173,29 @@ function getAvailabilityResult(availabilityData: Availability, index: number): b
|
|
|
172
173
|
* @param options
|
|
173
174
|
* @returns
|
|
174
175
|
*/
|
|
175
|
-
function formatTileData(
|
|
176
|
-
|
|
176
|
+
function formatTileData(
|
|
177
|
+
tile,
|
|
178
|
+
level: number,
|
|
179
|
+
childCoordinates: {childTileX: number; childTileY: number; childTileZ: number},
|
|
180
|
+
options: any
|
|
181
|
+
) {
|
|
182
|
+
const {
|
|
183
|
+
basePath,
|
|
184
|
+
refine,
|
|
185
|
+
getRefine,
|
|
186
|
+
lodMetricType,
|
|
187
|
+
getTileType,
|
|
188
|
+
rootLodMetricValue,
|
|
189
|
+
rootBoundingVolume
|
|
190
|
+
} = options;
|
|
177
191
|
const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, '');
|
|
178
192
|
const lodMetricValue = rootLodMetricValue / 2 ** level;
|
|
179
|
-
|
|
193
|
+
const boundingVolume = calculateBoundingVolumeForChildTile(
|
|
194
|
+
level,
|
|
195
|
+
rootBoundingVolume,
|
|
196
|
+
childCoordinates
|
|
197
|
+
);
|
|
198
|
+
|
|
180
199
|
return {
|
|
181
200
|
children: tile.children,
|
|
182
201
|
contentUrl: tile.contentUrl,
|
|
@@ -185,7 +204,8 @@ function formatTileData(tile, level: number, options: any) {
|
|
|
185
204
|
refine: getRefine(refine),
|
|
186
205
|
type: getTileType(tile),
|
|
187
206
|
lodMetricType,
|
|
188
|
-
lodMetricValue
|
|
207
|
+
lodMetricValue,
|
|
208
|
+
boundingVolume
|
|
189
209
|
// Temp debug values. Remove when real implicit tileset will be tested.
|
|
190
210
|
// x: tile.x,
|
|
191
211
|
// y: tile.y,
|
|
@@ -194,6 +214,44 @@ function formatTileData(tile, level: number, options: any) {
|
|
|
194
214
|
};
|
|
195
215
|
}
|
|
196
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Calculate child bounding volume.
|
|
219
|
+
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-rules
|
|
220
|
+
* @param level
|
|
221
|
+
* @param rootBoundingVolume
|
|
222
|
+
* @param childCoordinates
|
|
223
|
+
*/
|
|
224
|
+
function calculateBoundingVolumeForChildTile(
|
|
225
|
+
level: number,
|
|
226
|
+
rootBoundingVolume: BoundingVolume,
|
|
227
|
+
childCoordinates: {childTileX: number; childTileY: number; childTileZ: number}
|
|
228
|
+
): BoundingVolume | null {
|
|
229
|
+
if (rootBoundingVolume.region) {
|
|
230
|
+
const {childTileX, childTileY, childTileZ} = childCoordinates;
|
|
231
|
+
const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;
|
|
232
|
+
const boundingVolumesCount = 2 ** level;
|
|
233
|
+
|
|
234
|
+
const sizeX = (east - west) / boundingVolumesCount;
|
|
235
|
+
const sizeY = (north - south) / boundingVolumesCount;
|
|
236
|
+
const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;
|
|
237
|
+
|
|
238
|
+
const [childWest, childEast] = [west + sizeX * childTileX, west + sizeX * (childTileX + 1)];
|
|
239
|
+
const [childSouth, childNorth] = [south + sizeY * childTileY, south + sizeY * (childTileY + 1)];
|
|
240
|
+
const [childMinimumHeight, childMaximumHeight] = [
|
|
241
|
+
minimumHeight + sizeZ * childTileZ,
|
|
242
|
+
minimumHeight + sizeZ * (childTileZ + 1)
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// eslint-disable-next-line no-console
|
|
251
|
+
console.warn('Unsupported bounding volume type: ', rootBoundingVolume);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
|
|
197
255
|
/**
|
|
198
256
|
* Do binary concatenation
|
|
199
257
|
* @param first
|
|
@@ -100,6 +100,7 @@ export async function normalizeImplicitTileHeaders(tileset: Tileset3D) {
|
|
|
100
100
|
const refine = tileset.root.refine;
|
|
101
101
|
// @ts-ignore
|
|
102
102
|
const rootLodMetricValue = tileset.root.geometricError;
|
|
103
|
+
const rootBoundingVolume = tileset.root.boundingVolume;
|
|
103
104
|
|
|
104
105
|
const options = {
|
|
105
106
|
contentUrlTemplate,
|
|
@@ -111,6 +112,7 @@ export async function normalizeImplicitTileHeaders(tileset: Tileset3D) {
|
|
|
111
112
|
basePath,
|
|
112
113
|
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
113
114
|
rootLodMetricValue,
|
|
115
|
+
rootBoundingVolume,
|
|
114
116
|
getTileType,
|
|
115
117
|
getRefine
|
|
116
118
|
};
|