@loaders.gl/tile-converter 5.0.0-alpha.11 → 5.0.0-alpha.14
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/LICENSE +1 -1
- package/README.md +180 -4
- package/bin/converter-v5.js +2 -0
- package/dist/converter.min.cjs +172 -182
- package/dist/i3s-server/bin/i3s-server.min.cjs +113 -158
- package/dist/index.cjs +18832 -19228
- package/dist/index.js +19566 -19968
- package/dist/v5/adapters.cjs +2002 -230
- package/dist/v5/adapters.d.ts +20 -0
- package/dist/v5/adapters.js +2005 -214
- package/dist/v5/archive-source.d.ts +36 -0
- package/dist/v5/browser-tileset-source.d.ts +55 -11
- package/dist/v5/browser.cjs +18 -0
- package/dist/v5/browser.d.ts +15 -1
- package/dist/v5/browser.js +26 -0
- package/dist/v5/conversion-api.d.ts +34 -0
- package/dist/v5/converter-cli.d.ts +1 -0
- package/dist/v5/converter-cli.js +1230 -0
- package/dist/v5/core.cjs +547 -77
- package/dist/v5/core.d.ts +3 -1
- package/dist/v5/core.js +540 -70
- package/dist/v5/feature-arrow.d.ts +1 -1
- package/dist/v5/i3s-mesh-conversion.d.ts +5 -1
- package/dist/v5/i3s-mesh-source-features.d.ts +2 -2
- package/dist/v5/i3s-mesh-source-material.d.ts +1 -1
- package/dist/v5/i3s-mesh-source.d.ts +2 -2
- package/dist/v5/i3s-selection-source.d.ts +70 -0
- package/dist/v5/index.cjs +15 -0
- package/dist/v5/index.d.ts +13 -1
- package/dist/v5/index.js +22 -0
- package/dist/v5/mesh-conversion.d.ts +21 -3
- package/dist/v5/mesh-draco.d.ts +2 -2
- package/dist/v5/mesh-features.d.ts +2 -2
- package/dist/v5/mesh-hierarchy.d.ts +47 -0
- package/dist/v5/mesh-source-features.d.ts +6 -5
- package/dist/v5/mesh-source-schema.d.ts +12 -0
- package/dist/v5/mesh-source-texture.d.ts +3 -3
- package/dist/v5/mesh-source.d.ts +10 -7
- package/dist/v5/mesh-tileset-sink.d.ts +5 -0
- package/dist/v5/mesh.d.ts +1 -1
- package/dist/v5/node-cli.d.ts +9 -0
- package/dist/v5/node-conversion.d.ts +34 -0
- package/dist/v5/node-feature-schema.d.ts +3 -0
- package/dist/v5/node-i3s-source.d.ts +41 -0
- package/dist/v5/node-source.d.ts +47 -0
- package/dist/v5/node.cjs +913 -0
- package/dist/v5/node.d.ts +6 -0
- package/dist/v5/node.js +890 -0
- package/dist/v5/point-cloud-attributes.d.ts +19 -0
- package/dist/v5/point-cloud-conversion.d.ts +1 -1
- package/dist/v5/point-cloud-copc.d.ts +44 -0
- package/dist/v5/point-cloud-file.d.ts +83 -0
- package/dist/v5/point-cloud-potree.d.ts +47 -0
- package/dist/v5/point-cloud-source-encoder.d.ts +1 -1
- package/dist/v5/point-cloud-source.d.ts +1 -1
- package/dist/v5/point-cloud-tileset.d.ts +44 -0
- package/dist/v5/point-cloud.d.ts +1 -1
- package/dist/v5/resource-manifest.d.ts +10 -1
- package/dist/v5/selected-mesh-source.d.ts +53 -0
- package/dist/v5/spatial-conversion.d.ts +1 -1
- package/dist/v5/tileset-source.d.ts +1 -1
- package/package.json +25 -32
- package/src/index.ts +4 -1
- package/src/v4/3d-tiles-converter/3d-tiles-converter.ts +11 -12
- package/src/v4/3d-tiles-converter/helpers/3d-tiles-content-converter.ts +7 -3
- package/src/v4/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts +2 -2
- package/src/v4/3d-tiles-converter/helpers/load-i3s.ts +4 -6
- package/src/v4/3d-tiles-converter/helpers/texture-atlas.ts +1 -1
- package/src/v4/3d-tiles-converter/helpers/validate-i3s-spatial-reference.ts +2 -2
- package/src/v4/3d-tiles-converter/json-templates/tileset.ts +58 -39
- package/src/v4/converter-cli.ts +10 -4
- package/src/v4/deps-installer/deps-installer.ts +3 -3
- package/src/v4/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
- package/src/v4/i3s-converter/helpers/batch-ids-extensions.ts +9 -10
- package/src/v4/i3s-converter/helpers/conversion-gltf.ts +108 -0
- package/src/v4/i3s-converter/helpers/coordinate-converter.ts +6 -5
- package/src/v4/i3s-converter/helpers/create-scene-server-path.ts +5 -6
- package/src/v4/i3s-converter/helpers/feature-attributes.ts +4 -4
- package/src/v4/i3s-converter/helpers/geometry-attributes.ts +1 -1
- package/src/v4/i3s-converter/helpers/geometry-converter.ts +69 -77
- package/src/v4/i3s-converter/helpers/gltf-attributes.ts +58 -74
- package/src/v4/i3s-converter/helpers/load-3d-tiles.ts +6 -54
- package/src/v4/i3s-converter/helpers/node-debug.ts +7 -3
- package/src/v4/i3s-converter/helpers/node-index-document.ts +11 -9
- package/src/v4/i3s-converter/helpers/node-pages.ts +3 -4
- package/src/v4/i3s-converter/helpers/preprocess-3d-tiles.ts +2 -2
- package/src/v4/i3s-converter/helpers/tileset-traversal.ts +1 -1
- package/src/v4/i3s-converter/i3s-converter.ts +29 -31
- package/src/v4/i3s-converter/json-templates/geometry-definitions.ts +71 -66
- package/src/v4/i3s-converter/json-templates/layers.ts +97 -132
- package/src/v4/i3s-converter/json-templates/metadata.ts +31 -21
- package/src/v4/i3s-converter/json-templates/node.ts +60 -74
- package/src/v4/i3s-converter/json-templates/scene-server.ts +36 -27
- package/src/v4/i3s-converter/json-templates/shared-resources.ts +62 -123
- package/src/v4/i3s-converter/json-templates/store.ts +39 -57
- package/src/v4/i3s-converter/types.ts +4 -4
- package/src/v4/i3s-server/controllers/slpk-controller.ts +3 -3
- package/src/v4/i3s-server/utils/create-scene-server.ts +3 -3
- package/src/v4/lib/utils/builder-input.ts +8 -0
- package/src/v4/lib/utils/conversion-dump.ts +5 -1
- package/src/v4/lib/utils/file-utils.ts +1 -1
- package/src/v4/lib/utils/hash-string.ts +21 -0
- package/src/v4/lib/utils/lod-conversion-utils.ts +3 -3
- package/src/v4/pgm-loader.ts +2 -2
- package/src/v5/adapters.ts +53 -0
- package/src/v5/archive-source.ts +235 -0
- package/src/v5/browser-tileset-source.ts +418 -48
- package/src/v5/browser.ts +46 -0
- package/src/v5/conversion-api.ts +184 -17
- package/src/v5/conversion-archive.ts +2 -2
- package/src/v5/converter-cli.ts +28 -0
- package/src/v5/core.ts +7 -0
- package/src/v5/feature-arrow.ts +2 -2
- package/src/v5/i3s-mesh-conversion.ts +41 -3
- package/src/v5/i3s-mesh-sink.ts +1 -1
- package/src/v5/i3s-mesh-source-features.ts +3 -3
- package/src/v5/i3s-mesh-source-material.ts +18 -11
- package/src/v5/i3s-mesh-source.ts +3 -2
- package/src/v5/i3s-selection-source.ts +298 -0
- package/src/v5/index.ts +41 -0
- package/src/v5/mesh-conversion.ts +24 -4
- package/src/v5/mesh-draco.ts +2 -2
- package/src/v5/mesh-features.ts +3 -3
- package/src/v5/mesh-hierarchy.ts +648 -0
- package/src/v5/mesh-source-features.ts +165 -51
- package/src/v5/mesh-source-schema.ts +140 -0
- package/src/v5/mesh-source-texture.ts +49 -19
- package/src/v5/mesh-source.ts +80 -49
- package/src/v5/mesh-tileset-archive.ts +1 -1
- package/src/v5/mesh-tileset-sink.ts +2 -2
- package/src/v5/mesh.ts +1 -1
- package/src/v5/node-cli.ts +201 -0
- package/src/v5/node-conversion.ts +362 -0
- package/src/v5/node-feature-schema.ts +155 -0
- package/src/v5/node-i3s-source.ts +181 -0
- package/src/v5/node-source.ts +328 -0
- package/src/v5/node.ts +16 -0
- package/src/v5/point-cloud-attributes.ts +113 -0
- package/src/v5/point-cloud-conversion.ts +1 -1
- package/src/v5/point-cloud-copc.ts +289 -0
- package/src/v5/point-cloud-file.ts +306 -0
- package/src/v5/point-cloud-potree.ts +134 -0
- package/src/v5/point-cloud-source-encoder.ts +1 -1
- package/src/v5/point-cloud-source.ts +1 -1
- package/src/v5/point-cloud-spatial.ts +2 -2
- package/src/v5/point-cloud-tileset.ts +137 -0
- package/src/v5/point-cloud.ts +3 -3
- package/src/v5/resource-fetcher.ts +4 -1
- package/src/v5/resource-manifest.ts +40 -5
- package/src/v5/selected-mesh-source.ts +384 -0
- package/src/v5/spatial-conversion.ts +90 -19
- package/src/v5/tileset-source.ts +2 -2
|
@@ -1,45 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
mbs: {
|
|
5
|
-
path: 'mbs'
|
|
6
|
-
},
|
|
7
|
-
obb: {
|
|
8
|
-
path: 'obb'
|
|
9
|
-
}
|
|
10
|
-
});
|
|
5
|
+
import type {BuilderInput} from '../../lib/utils/builder-input';
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
href: {
|
|
14
|
-
path: 'href'
|
|
15
|
-
}
|
|
16
|
-
});
|
|
7
|
+
import type {BoundingVolumes, NodeReference, Node3DIndexDocument} from '@loaders.gl/tiles-3d/i3s';
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
...COORDINATES()
|
|
24
|
-
});
|
|
9
|
+
/** Legacy node documents may include a path in addition to the typed I3S fields. */
|
|
10
|
+
type NodeBuilderRecord = Node3DIndexDocument & {
|
|
11
|
+
/** Legacy document path. */
|
|
12
|
+
path?: string;
|
|
13
|
+
};
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
/** Builds coordinates with the legacy field selection and defaults. */
|
|
16
|
+
function createCoordinates(input: BuilderInput<BoundingVolumes> | null | undefined) {
|
|
17
|
+
const source = input ?? {};
|
|
18
|
+
return {
|
|
19
|
+
mbs: source.mbs ?? undefined,
|
|
20
|
+
obb: source.obb ?? undefined
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Builds href with the legacy field selection and defaults. */
|
|
25
|
+
function createHref(input: BuilderInput<Pick<NodeReference, 'href'>> | null | undefined) {
|
|
26
|
+
const source = input ?? {};
|
|
27
|
+
return {
|
|
28
|
+
href: source.href ?? undefined
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Builds parent node with the legacy field selection and defaults. */
|
|
33
|
+
function createParentNode(input: BuilderInput<NodeReference> | null | undefined): NodeReference {
|
|
34
|
+
const source = input ?? {};
|
|
35
|
+
return {
|
|
36
|
+
id: source.id ?? undefined,
|
|
37
|
+
...createHref(source),
|
|
38
|
+
...createCoordinates(source)
|
|
39
|
+
} as NodeReference;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Builds node with the legacy field selection and defaults. */
|
|
43
|
+
export function createNode(
|
|
44
|
+
input: BuilderInput<NodeBuilderRecord> | null | undefined
|
|
45
|
+
): NodeBuilderRecord {
|
|
46
|
+
const source = input ?? {};
|
|
47
|
+
return {
|
|
48
|
+
version: source.version ?? undefined,
|
|
49
|
+
id: source.id ?? undefined,
|
|
50
|
+
path: source.path ?? undefined,
|
|
51
|
+
level: source.level ?? undefined,
|
|
52
|
+
...createCoordinates(source),
|
|
53
|
+
lodSelection: source.lodSelection ?? [
|
|
43
54
|
{
|
|
44
55
|
metricType: 'maxScreenThresholdSQ',
|
|
45
56
|
maxError: 196349.54374999998
|
|
@@ -48,39 +59,14 @@ export const NODE = () => ({
|
|
|
48
59
|
metricType: 'maxScreenThreshold',
|
|
49
60
|
maxError: 999.9999999999999
|
|
50
61
|
}
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
path: 'parentNode',
|
|
63
|
-
transform: val => transform(val, PARENT_NODE()),
|
|
64
|
-
default: null
|
|
65
|
-
},
|
|
66
|
-
sharedResource: {
|
|
67
|
-
path: 'sharedResource',
|
|
68
|
-
default: null
|
|
69
|
-
},
|
|
70
|
-
featureData: {
|
|
71
|
-
path: 'featureData',
|
|
72
|
-
default: null
|
|
73
|
-
},
|
|
74
|
-
geometryData: {
|
|
75
|
-
path: 'geometryData',
|
|
76
|
-
default: null
|
|
77
|
-
},
|
|
78
|
-
textureData: {
|
|
79
|
-
path: 'textureData',
|
|
80
|
-
default: null
|
|
81
|
-
},
|
|
82
|
-
attributeData: {
|
|
83
|
-
path: 'attributeData',
|
|
84
|
-
default: null
|
|
85
|
-
}
|
|
86
|
-
});
|
|
62
|
+
],
|
|
63
|
+
children: source.children ?? undefined,
|
|
64
|
+
neighbors: source.neighbors ?? undefined,
|
|
65
|
+
parentNode: createParentNode(source.parentNode) ?? undefined,
|
|
66
|
+
sharedResource: source.sharedResource ?? undefined,
|
|
67
|
+
featureData: source.featureData ?? undefined,
|
|
68
|
+
geometryData: source.geometryData ?? undefined,
|
|
69
|
+
textureData: source.textureData ?? undefined,
|
|
70
|
+
attributeData: source.attributeData ?? undefined
|
|
71
|
+
} as NodeBuilderRecord;
|
|
72
|
+
}
|
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {BuilderInput} from '../../lib/utils/builder-input';
|
|
6
|
+
|
|
7
|
+
import type {SceneLayer3D} from '@loaders.gl/tiles-3d/i3s';
|
|
8
|
+
/** Legacy scene service input and output fields. */
|
|
9
|
+
export type SceneServerRecord = {
|
|
10
|
+
/** Service identifier. */
|
|
11
|
+
serviceItemId?: string;
|
|
12
|
+
/** Input layer name. */
|
|
13
|
+
layerName?: string;
|
|
14
|
+
/** Layer document. */
|
|
15
|
+
layers0?: SceneLayer3D;
|
|
16
|
+
/** Server version. */
|
|
17
|
+
currentVersion: number;
|
|
18
|
+
/** Service version. */
|
|
19
|
+
serviceVersion: string;
|
|
20
|
+
/** Supported protocols. */
|
|
21
|
+
supportedBindings: string[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Builds scene server with the legacy field selection and defaults. */
|
|
25
|
+
export function createSceneServer(input: BuilderInput<SceneServerRecord> | null | undefined) {
|
|
26
|
+
const source = input ?? {};
|
|
27
|
+
return {
|
|
28
|
+
serviceItemId: source.serviceItemId ?? undefined,
|
|
29
|
+
serviceName: source.layerName ?? undefined,
|
|
30
|
+
name: source.layerName ?? undefined,
|
|
31
|
+
currentVersion: source.currentVersion ?? 10.7,
|
|
32
|
+
serviceVersion: source.serviceVersion ?? '1.8',
|
|
33
|
+
supportedBindings: source.supportedBindings ?? ['REST'],
|
|
34
|
+
layers: [source.layers0 ?? undefined]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -1,134 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
renderMode: {
|
|
5
|
-
path: 'renderMode',
|
|
6
|
-
default: 'solid'
|
|
7
|
-
},
|
|
8
|
-
shininess: {
|
|
9
|
-
path: 'shininess',
|
|
10
|
-
default: 1
|
|
11
|
-
},
|
|
12
|
-
reflectivity: {
|
|
13
|
-
path: 'reflectivity',
|
|
14
|
-
default: 0
|
|
15
|
-
},
|
|
16
|
-
ambient: {
|
|
17
|
-
path: 'ambient',
|
|
18
|
-
default: [1, 1, 1]
|
|
19
|
-
},
|
|
20
|
-
diffuse: {
|
|
21
|
-
path: 'diffuse',
|
|
22
|
-
default: [1, 1, 1]
|
|
23
|
-
},
|
|
24
|
-
specular: {
|
|
25
|
-
path: 'specular',
|
|
26
|
-
default: [0, 0, 0]
|
|
27
|
-
},
|
|
28
|
-
useVertexColorAlpha: {
|
|
29
|
-
path: 'useVertexColorAlpha',
|
|
30
|
-
default: false
|
|
31
|
-
},
|
|
32
|
-
vertexRegions: {
|
|
33
|
-
path: 'vertexRegions',
|
|
34
|
-
default: false
|
|
35
|
-
},
|
|
36
|
-
vertexColors: {
|
|
37
|
-
path: 'vertexColors',
|
|
38
|
-
default: true
|
|
39
|
-
}
|
|
40
|
-
});
|
|
5
|
+
import type {BuilderInput} from '../../lib/utils/builder-input';
|
|
41
6
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
path: 'name',
|
|
45
|
-
default: 'standard'
|
|
46
|
-
},
|
|
47
|
-
type: {
|
|
48
|
-
path: 'type',
|
|
49
|
-
default: 'standard'
|
|
50
|
-
},
|
|
51
|
-
params: {
|
|
52
|
-
path: 'params',
|
|
53
|
-
transform: (val, thisObject, originalObject) =>
|
|
54
|
-
transform(originalObject, MATERIAL_DEFINITION_INFO_PARAMS())
|
|
55
|
-
}
|
|
56
|
-
});
|
|
7
|
+
import type {MaterialDefinitionInfo, TextureDefinitionInfo} from '@loaders.gl/tiles-3d/i3s';
|
|
8
|
+
import type {SharedResourcesArrays} from '../types';
|
|
57
9
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
href: {
|
|
66
|
-
path: 'href',
|
|
67
|
-
default: ['../textures/0']
|
|
68
|
-
},
|
|
69
|
-
length: {
|
|
70
|
-
path: 'length'
|
|
71
|
-
}
|
|
72
|
-
});
|
|
10
|
+
/** Legacy material fields are selected from the material record, rather than its params field. */
|
|
11
|
+
/** Legacy texture records receive the generated image index as an annotation. */
|
|
12
|
+
type IndexedTexture = TextureDefinitionInfo & {
|
|
13
|
+
/** Generated legacy image index. */
|
|
14
|
+
imageIndex?: string;
|
|
15
|
+
};
|
|
73
16
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
wrap: {
|
|
79
|
-
path: 'wrap',
|
|
80
|
-
default: ['none']
|
|
81
|
-
},
|
|
82
|
-
atlas: {
|
|
83
|
-
path: 'atlas',
|
|
84
|
-
default: false
|
|
85
|
-
},
|
|
86
|
-
uvSet: {
|
|
87
|
-
path: 'uvSet',
|
|
88
|
-
default: 'uv0'
|
|
89
|
-
},
|
|
90
|
-
channels: {
|
|
91
|
-
path: 'channels',
|
|
92
|
-
default: 'rgb'
|
|
93
|
-
},
|
|
94
|
-
images: {
|
|
95
|
-
path: 'images',
|
|
96
|
-
transform: (val, thisObject, originalObject) =>
|
|
97
|
-
val.map(image => transform(image, TEXTURE_DEFINITION_IMAGE()))
|
|
98
|
-
}
|
|
99
|
-
});
|
|
17
|
+
/** Material parameters are selected from the root record. */
|
|
18
|
+
type MaterialInput = BuilderInput<MaterialDefinitionInfo> &
|
|
19
|
+
BuilderInput<MaterialDefinitionInfo['params']>;
|
|
100
20
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
21
|
+
/** Builds one material while retaining the legacy root-level parameter selection. */
|
|
22
|
+
function createMaterial(input: MaterialInput) {
|
|
23
|
+
return {
|
|
24
|
+
name: input.name ?? 'standard',
|
|
25
|
+
type: input.type ?? 'standard',
|
|
26
|
+
params: {
|
|
27
|
+
renderMode: input.renderMode ?? 'solid',
|
|
28
|
+
shininess: input.shininess ?? 1,
|
|
29
|
+
reflectivity: input.reflectivity ?? 0,
|
|
30
|
+
ambient: input.ambient ?? [1, 1, 1],
|
|
31
|
+
diffuse: input.diffuse ?? [1, 1, 1],
|
|
32
|
+
specular: input.specular ?? [0, 0, 0],
|
|
33
|
+
useVertexColorAlpha: input.useVertexColorAlpha ?? false,
|
|
34
|
+
vertexRegions: input.vertexRegions ?? false,
|
|
35
|
+
vertexColors: input.vertexColors ?? true
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
111
39
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
40
|
+
/** Builds a texture record with the historical image fields and defaults. */
|
|
41
|
+
function createTexture(input: BuilderInput<TextureDefinitionInfo>) {
|
|
42
|
+
return {
|
|
43
|
+
encoding: input.encoding ?? undefined,
|
|
44
|
+
wrap: input.wrap ?? ['none'],
|
|
45
|
+
atlas: input.atlas ?? false,
|
|
46
|
+
uvSet: input.uvSet ?? 'uv0',
|
|
47
|
+
channels: input.channels ?? 'rgb',
|
|
48
|
+
images: input.images!.map(image => ({
|
|
49
|
+
id: image.id ?? undefined,
|
|
50
|
+
size: image.size ?? undefined,
|
|
51
|
+
href: image.href ?? ['../textures/0'],
|
|
52
|
+
length: image.length ?? undefined
|
|
53
|
+
}))
|
|
54
|
+
};
|
|
121
55
|
}
|
|
122
56
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
57
|
+
/** Builds shared resources, preserving generated keys and the legacy image-index annotation. */
|
|
58
|
+
export function createSharedResources(input: SharedResourcesArrays) {
|
|
59
|
+
const materialDefinitions: Record<string, ReturnType<typeof createMaterial>> = {};
|
|
60
|
+
for (const [index, material] of input.materialDefinitionInfos!.entries()) {
|
|
61
|
+
materialDefinitions[`Mat${input.nodePath}${index}`] = createMaterial(material);
|
|
126
62
|
}
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
63
|
+
const textureDefinitions: Record<string, ReturnType<typeof createTexture>> | null =
|
|
64
|
+
input.textureDefinitionInfos ? {} : null;
|
|
65
|
+
if (textureDefinitions) {
|
|
66
|
+
for (const [index, texture] of input.textureDefinitionInfos!.entries()) {
|
|
67
|
+
const imageIndex = `${input.nodePath}${index}`;
|
|
68
|
+
(texture as IndexedTexture).imageIndex = imageIndex;
|
|
69
|
+
textureDefinitions[imageIndex] = createTexture(texture);
|
|
70
|
+
}
|
|
132
71
|
}
|
|
133
|
-
return
|
|
72
|
+
return {materialDefinitions, textureDefinitions};
|
|
134
73
|
}
|
|
@@ -1,58 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
path: 'attributeEncoding',
|
|
39
|
-
default: 'application/octet-stream; version=1.6'
|
|
40
|
-
},
|
|
41
|
-
textureEncoding: {
|
|
42
|
-
path: 'textureEncoding',
|
|
43
|
-
default: ['image/jpeg', 'image/ktx2']
|
|
44
|
-
},
|
|
45
|
-
lodType: {
|
|
46
|
-
path: 'lodType',
|
|
47
|
-
default: 'MeshPyramid'
|
|
48
|
-
},
|
|
49
|
-
lodModel: {
|
|
50
|
-
path: 'lodModel',
|
|
51
|
-
default: 'node-switching'
|
|
52
|
-
},
|
|
53
|
-
defaultGeometrySchema: {
|
|
54
|
-
path: 'defaultGeometrySchema',
|
|
55
|
-
default: {
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {BuilderInput} from '../../lib/utils/builder-input';
|
|
6
|
+
|
|
7
|
+
import type {Store} from '@loaders.gl/tiles-3d/i3s';
|
|
8
|
+
|
|
9
|
+
/** Converter stores use the legacy uppercase string identifier. */
|
|
10
|
+
export type StoreBuilderRecord = Omit<Store, 'id'> & {
|
|
11
|
+
/** Store identifier before uppercase normalization. */
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Builds store with the legacy field selection and defaults. */
|
|
16
|
+
export function createStore(input: BuilderInput<StoreBuilderRecord> | null | undefined): Store {
|
|
17
|
+
const source = input ?? {};
|
|
18
|
+
return {
|
|
19
|
+
id: source.id!.toUpperCase(),
|
|
20
|
+
profile: source.profile ?? 'meshpyramids',
|
|
21
|
+
version: source.version ?? '1.8',
|
|
22
|
+
resourcePattern: source.resourcePattern ?? [
|
|
23
|
+
'3dNodeIndexDocument',
|
|
24
|
+
'Attributes',
|
|
25
|
+
'SharedResource',
|
|
26
|
+
'Geometry'
|
|
27
|
+
],
|
|
28
|
+
rootNode: source.rootNode ?? './nodes/root',
|
|
29
|
+
extent: source.extent ?? undefined,
|
|
30
|
+
indexCRS: source.indexCRS ?? 'http://www.opengis.net/def/crs/EPSG/0/4326',
|
|
31
|
+
vertexCRS: source.vertexCRS ?? 'http://www.opengis.net/def/crs/EPSG/0/4326',
|
|
32
|
+
normalReferenceFrame: source.normalReferenceFrame ?? 'earth-centered',
|
|
33
|
+
attributeEncoding: source.attributeEncoding ?? 'application/octet-stream; version=1.6',
|
|
34
|
+
textureEncoding: source.textureEncoding ?? ['image/jpeg', 'image/ktx2'],
|
|
35
|
+
lodType: source.lodType ?? 'MeshPyramid',
|
|
36
|
+
lodModel: source.lodModel ?? 'node-switching',
|
|
37
|
+
defaultGeometrySchema: source.defaultGeometrySchema ?? {
|
|
56
38
|
geometryType: 'triangles',
|
|
57
39
|
header: [
|
|
58
40
|
{
|
|
@@ -96,5 +78,5 @@ export const STORE = {
|
|
|
96
78
|
}
|
|
97
79
|
}
|
|
98
80
|
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
81
|
+
} as Store;
|
|
82
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {ConversionNode, ConversionImage} from './helpers/conversion-gltf';
|
|
2
2
|
import {
|
|
3
3
|
BoundingVolumes,
|
|
4
4
|
I3SMaterialDefinition,
|
|
5
5
|
MaterialDefinitionInfo,
|
|
6
6
|
TextureDefinitionInfo
|
|
7
|
-
} from '@loaders.gl/i3s';
|
|
7
|
+
} from '@loaders.gl/tiles-3d/i3s';
|
|
8
8
|
import {Matrix4, Vector3} from '@math.gl/core';
|
|
9
9
|
|
|
10
10
|
/** Converted resources for specific node */
|
|
@@ -141,7 +141,7 @@ export type I3SMaterialWithTexture = {
|
|
|
141
141
|
/** Material definition https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */
|
|
142
142
|
material: I3SMaterialDefinition;
|
|
143
143
|
/** Texture content (image) */
|
|
144
|
-
texture?:
|
|
144
|
+
texture?: ConversionImage;
|
|
145
145
|
/** Metadata of all merged materials */
|
|
146
146
|
mergedMaterials: MergedMaterial[];
|
|
147
147
|
};
|
|
@@ -217,7 +217,7 @@ export type GLTFAttributesData = {
|
|
|
217
217
|
/** glTF PBR materials (only id is required) */
|
|
218
218
|
gltfMaterials?: {id: string}[];
|
|
219
219
|
/** glTF geometry nodes */
|
|
220
|
-
nodes:
|
|
220
|
+
nodes: ConversionNode[];
|
|
221
221
|
/** glTF texture images (set to null for compressed textures) */
|
|
222
222
|
images: (null | TextureImageProperties)[];
|
|
223
223
|
/** Source tile origin coordinates in cartographic coordinate system */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import '@loaders.gl/polyfills';
|
|
2
|
-
import {parseSLPKArchive, SLPKArchive} from '@loaders.gl/i3s';
|
|
3
|
-
import {NodeFile} from '@loaders.gl/loader-utils';
|
|
1
|
+
import '@loaders.gl/core/polyfills';
|
|
2
|
+
import {parseSLPKArchive, SLPKArchive} from '@loaders.gl/tiles-3d/i3s';
|
|
3
|
+
import {NodeFile} from '@loaders.gl/core/loader-utils';
|
|
4
4
|
|
|
5
5
|
let slpkArchive: SLPKArchive;
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {SceneLayer3D} from '@loaders.gl/i3s';
|
|
2
|
-
import {
|
|
1
|
+
import {SceneLayer3D} from '@loaders.gl/tiles-3d/i3s';
|
|
2
|
+
import {randomUUID} from 'node:crypto';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create `/SceneServer` response
|
|
@@ -9,7 +9,7 @@ import {v4 as uuidv4} from 'uuid';
|
|
|
9
9
|
*/
|
|
10
10
|
export const createSceneServer = (name: string, layer: SceneLayer3D) => {
|
|
11
11
|
return {
|
|
12
|
-
serviceItemId:
|
|
12
|
+
serviceItemId: randomUUID().replace(/-/gi, ''),
|
|
13
13
|
serviceName: name,
|
|
14
14
|
name,
|
|
15
15
|
currentVersion: '10.7',
|
|
@@ -2,7 +2,11 @@ import {isDeepStrictEqual} from 'util';
|
|
|
2
2
|
import {DUMP_FILE_SUFFIX} from '../../constants';
|
|
3
3
|
import {isFileExists, openJson, removeFile, renameFile, writeFile} from './file-utils';
|
|
4
4
|
import {join} from 'path';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
BoundingVolumes,
|
|
7
|
+
I3SMaterialDefinition,
|
|
8
|
+
TextureSetDefinitionFormats
|
|
9
|
+
} from '@loaders.gl/tiles-3d/i3s';
|
|
6
10
|
import {AttributeMetadataInfoObject} from '../../i3s-converter/helpers/attribute-metadata-info';
|
|
7
11
|
import process from 'process';
|
|
8
12
|
import Ajv from 'ajv';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {load} from '@loaders.gl/core';
|
|
2
|
-
import {JSONLoader} from '@loaders.gl/loader-utils';
|
|
2
|
+
import {JSONLoader} from '@loaders.gl/core/loader-utils';
|
|
3
3
|
import {promises as fs} from 'fs';
|
|
4
4
|
import {isAbsolute, join} from 'path';
|
|
5
5
|
import {compressFileWithGzip} from './compress-util';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {MD5Hash} from '@loaders.gl/crypto';
|
|
6
|
+
|
|
7
|
+
/** Shared synchronous calculator for converter identifiers. */
|
|
8
|
+
const md5Hash = new MD5Hash();
|
|
9
|
+
/** Encodes converter identifiers as UTF-8. */
|
|
10
|
+
const textEncoder = new TextEncoder();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Computes the legacy lowercase MD5 identifier from a UTF-8 converter string.
|
|
14
|
+
* @throws URIError when the input contains an unpaired surrogate, matching the legacy encoder.
|
|
15
|
+
*/
|
|
16
|
+
export function hashString(value: string): string {
|
|
17
|
+
if (/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(value)) {
|
|
18
|
+
throw new URIError('URI malformed');
|
|
19
|
+
}
|
|
20
|
+
return md5Hash.hashSync(textEncoder.encode(value).buffer, 'hex');
|
|
21
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Tiles3DTileJSONPostprocessed} from '@loaders.gl/3d-tiles';
|
|
2
|
-
import {BoundingVolumes} from '@loaders.gl/i3s';
|
|
3
|
-
import {I3STileHeader} from '@loaders.gl/i3s
|
|
1
|
+
import {Tiles3DTileJSONPostprocessed} from '@loaders.gl/tiles-3d/3d-tiles';
|
|
2
|
+
import {BoundingVolumes} from '@loaders.gl/tiles-3d/i3s';
|
|
3
|
+
import type {I3STileHeader} from '@loaders.gl/tiles-3d/i3s';
|
|
4
4
|
|
|
5
5
|
// https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html
|
|
6
6
|
const DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
|
package/src/v4/pgm-loader.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
|
-
import {Geoid, parsePGM} from '@math.gl/geoid';
|
|
1
|
+
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/core/loader-utils';
|
|
2
|
+
import {Geoid, parsePGM} from '@math.gl/earth/geoid';
|
|
3
3
|
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|