@loaders.gl/i3s 3.1.0-beta.5 → 3.1.2
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 -10364
- package/dist/dist.min.js +10371 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +147 -62
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +36 -8
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +36 -10
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +175 -51
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +51 -8
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js +6 -6
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +328 -173
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +9 -28
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +69 -27
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +62 -28
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +416 -314
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +109 -49
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +8 -4
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +14 -17
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +10 -2
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +33 -23
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/constants.js +2 -18
- package/dist/esm/lib/parsers/constants.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +44 -61
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +40 -25
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/lib/utils/url-utils.js +2 -3
- package/dist/esm/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/types.js +7 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-worker.js +106 -95
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +20 -20
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +33 -32
- package/dist/lib/parsers/constants.d.ts +1 -17
- package/dist/lib/parsers/constants.d.ts.map +1 -1
- package/dist/lib/parsers/constants.js +3 -21
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +35 -61
- package/dist/lib/parsers/parse-i3s.d.ts +5 -3
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +37 -32
- package/dist/lib/utils/url-utils.d.ts +6 -6
- package/dist/lib/utils/url-utils.d.ts.map +1 -1
- package/dist/lib/utils/url-utils.js +5 -5
- package/dist/types.d.ts +289 -74
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -1
- package/package.json +10 -10
- package/src/i3s-building-scene-layer-loader.ts +1 -1
- package/src/i3s-content-loader.ts +1 -1
- package/src/index.ts +3 -3
- package/src/lib/helpers/i3s-nodepages-tiles.ts +71 -55
- package/src/lib/parsers/constants.ts +2 -22
- package/src/lib/parsers/parse-i3s-tile-content.ts +74 -103
- package/src/lib/parsers/parse-i3s.ts +48 -37
- package/src/lib/utils/url-utils.ts +7 -7
- package/src/types.ts +302 -93
|
@@ -4,69 +4,80 @@ import {load} from '@loaders.gl/core';
|
|
|
4
4
|
import {TILE_TYPE, TILE_REFINEMENT, TILESET_TYPE} from '@loaders.gl/tiles';
|
|
5
5
|
import I3SNodePagesTiles from '../helpers/i3s-nodepages-tiles';
|
|
6
6
|
import {generateTileAttributeUrls, getUrlWithToken} from '../utils/url-utils';
|
|
7
|
+
import {
|
|
8
|
+
I3STilesetHeader,
|
|
9
|
+
I3STileHeader,
|
|
10
|
+
Mbs,
|
|
11
|
+
I3SMinimalNodeData,
|
|
12
|
+
Node3DIndexDocument
|
|
13
|
+
} from '../../types';
|
|
14
|
+
import type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';
|
|
7
15
|
|
|
8
|
-
export function normalizeTileData(tile, options, context) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (tile.featureData) {
|
|
12
|
-
tile.featureUrl = `${tile.url}/${tile.featureData[0].href}`;
|
|
13
|
-
}
|
|
14
|
-
|
|
16
|
+
export function normalizeTileData(tile : Node3DIndexDocument, options : LoaderOptions, context: LoaderContext): I3STileHeader {
|
|
17
|
+
const url: string = context.url || '';
|
|
18
|
+
let contentUrl: string | undefined;
|
|
15
19
|
if (tile.geometryData) {
|
|
16
|
-
|
|
20
|
+
contentUrl = `${url}/${tile.geometryData[0].href}`;
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
let textureUrl: string | undefined;
|
|
19
24
|
if (tile.textureData) {
|
|
20
|
-
|
|
25
|
+
textureUrl = `${url}/${tile.textureData[0].href}`;
|
|
21
26
|
}
|
|
22
27
|
|
|
28
|
+
let attributeUrls: string[] | undefined;
|
|
23
29
|
if (tile.attributeData) {
|
|
24
|
-
|
|
30
|
+
attributeUrls = generateTileAttributeUrls(url, tile);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
return normalizeTileNonUrlData(
|
|
33
|
+
return normalizeTileNonUrlData({
|
|
34
|
+
...tile,
|
|
35
|
+
url,
|
|
36
|
+
contentUrl,
|
|
37
|
+
textureUrl,
|
|
38
|
+
attributeUrls,
|
|
39
|
+
isDracoGeometry: false
|
|
40
|
+
});
|
|
28
41
|
}
|
|
29
42
|
|
|
30
|
-
export function normalizeTileNonUrlData(tile) {
|
|
31
|
-
const box =
|
|
32
|
-
|
|
33
|
-
...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box
|
|
34
|
-
...tile.obb.halfSize, // halfSize
|
|
35
|
-
...tile.obb.quaternion // quaternion
|
|
36
|
-
]
|
|
37
|
-
: undefined;
|
|
38
|
-
let sphere;
|
|
43
|
+
export function normalizeTileNonUrlData(tile : I3SMinimalNodeData): I3STileHeader {
|
|
44
|
+
const boundingVolume: {box?: number[]; sphere?: number[]} = {};
|
|
45
|
+
let mbs: Mbs = [0, 0, 0, 1];
|
|
39
46
|
if (tile.mbs) {
|
|
40
|
-
|
|
47
|
+
mbs = tile.mbs;
|
|
48
|
+
boundingVolume.sphere = [
|
|
41
49
|
...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere
|
|
42
50
|
tile.mbs[3] // radius of sphere
|
|
51
|
+
] as Mbs;
|
|
52
|
+
} else if (tile.obb) {
|
|
53
|
+
boundingVolume.box = [
|
|
54
|
+
...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box
|
|
55
|
+
...tile.obb.halfSize, // halfSize
|
|
56
|
+
...tile.obb.quaternion // quaternion
|
|
43
57
|
];
|
|
44
|
-
} else if (box) {
|
|
45
58
|
const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(
|
|
46
|
-
box.slice(0, 3),
|
|
59
|
+
boundingVolume.box.slice(0, 3),
|
|
47
60
|
tile.obb.halfSize,
|
|
48
61
|
tile.obb.quaternion
|
|
49
62
|
);
|
|
50
63
|
const boundingSphere = obb.getBoundingSphere();
|
|
51
|
-
sphere = [...boundingSphere.center, boundingSphere.radius];
|
|
52
|
-
|
|
64
|
+
boundingVolume.sphere = [...boundingSphere.center , boundingSphere.radius] as Mbs;
|
|
65
|
+
mbs = [...tile.obb.center, boundingSphere.radius] as Mbs;
|
|
53
66
|
}
|
|
54
67
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// TODO only support replacement for now
|
|
64
|
-
tile.refine = TILE_REFINEMENT.REPLACE;
|
|
68
|
+
const lodMetricType = tile.lodSelection?.[0].metricType;
|
|
69
|
+
const lodMetricValue = tile.lodSelection?.[0].maxError;
|
|
70
|
+
const transformMatrix = tile.transform;
|
|
71
|
+
const type = TILE_TYPE.MESH;
|
|
72
|
+
/**
|
|
73
|
+
* I3S specification supports only REPLACE
|
|
74
|
+
*/
|
|
75
|
+
const refine = TILE_REFINEMENT.REPLACE;
|
|
65
76
|
|
|
66
|
-
return tile;
|
|
77
|
+
return {...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, transformMatrix, type, refine};
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
export async function normalizeTilesetData(tileset, options, context) {
|
|
80
|
+
export async function normalizeTilesetData(tileset : I3STilesetHeader, options : LoaderOptions, context: LoaderContext) {
|
|
70
81
|
tileset.url = context.url;
|
|
71
82
|
|
|
72
83
|
if (tileset.nodePages) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Node3DIndexDocument} from '../../types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates url with token if it is exists.
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
5
|
+
* @param url
|
|
6
|
+
* @param token
|
|
7
|
+
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export function getUrlWithToken(url: string, token = null): string {
|
|
9
|
+
export function getUrlWithToken(url: string, token: string | null = null): string {
|
|
10
10
|
return token ? `${url}?token=${token}` : url;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -15,8 +15,8 @@ export function getUrlWithToken(url: string, token = null): string {
|
|
|
15
15
|
* @param tile
|
|
16
16
|
* @returns list of attribute urls
|
|
17
17
|
*/
|
|
18
|
-
export function generateTileAttributeUrls(tile:
|
|
19
|
-
const {
|
|
18
|
+
export function generateTileAttributeUrls(url: string, tile: Node3DIndexDocument): string[] {
|
|
19
|
+
const {attributeData = []} = tile;
|
|
20
20
|
const attributeUrls: string[] = [];
|
|
21
21
|
|
|
22
22
|
for (let index = 0; index < attributeData.length; index++) {
|