@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.
Files changed (152) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +180 -4
  3. package/bin/converter-v5.js +2 -0
  4. package/dist/converter.min.cjs +172 -182
  5. package/dist/i3s-server/bin/i3s-server.min.cjs +113 -158
  6. package/dist/index.cjs +18832 -19228
  7. package/dist/index.js +19566 -19968
  8. package/dist/v5/adapters.cjs +2002 -230
  9. package/dist/v5/adapters.d.ts +20 -0
  10. package/dist/v5/adapters.js +2005 -214
  11. package/dist/v5/archive-source.d.ts +36 -0
  12. package/dist/v5/browser-tileset-source.d.ts +55 -11
  13. package/dist/v5/browser.cjs +18 -0
  14. package/dist/v5/browser.d.ts +15 -1
  15. package/dist/v5/browser.js +26 -0
  16. package/dist/v5/conversion-api.d.ts +34 -0
  17. package/dist/v5/converter-cli.d.ts +1 -0
  18. package/dist/v5/converter-cli.js +1230 -0
  19. package/dist/v5/core.cjs +547 -77
  20. package/dist/v5/core.d.ts +3 -1
  21. package/dist/v5/core.js +540 -70
  22. package/dist/v5/feature-arrow.d.ts +1 -1
  23. package/dist/v5/i3s-mesh-conversion.d.ts +5 -1
  24. package/dist/v5/i3s-mesh-source-features.d.ts +2 -2
  25. package/dist/v5/i3s-mesh-source-material.d.ts +1 -1
  26. package/dist/v5/i3s-mesh-source.d.ts +2 -2
  27. package/dist/v5/i3s-selection-source.d.ts +70 -0
  28. package/dist/v5/index.cjs +15 -0
  29. package/dist/v5/index.d.ts +13 -1
  30. package/dist/v5/index.js +22 -0
  31. package/dist/v5/mesh-conversion.d.ts +21 -3
  32. package/dist/v5/mesh-draco.d.ts +2 -2
  33. package/dist/v5/mesh-features.d.ts +2 -2
  34. package/dist/v5/mesh-hierarchy.d.ts +47 -0
  35. package/dist/v5/mesh-source-features.d.ts +6 -5
  36. package/dist/v5/mesh-source-schema.d.ts +12 -0
  37. package/dist/v5/mesh-source-texture.d.ts +3 -3
  38. package/dist/v5/mesh-source.d.ts +10 -7
  39. package/dist/v5/mesh-tileset-sink.d.ts +5 -0
  40. package/dist/v5/mesh.d.ts +1 -1
  41. package/dist/v5/node-cli.d.ts +9 -0
  42. package/dist/v5/node-conversion.d.ts +34 -0
  43. package/dist/v5/node-feature-schema.d.ts +3 -0
  44. package/dist/v5/node-i3s-source.d.ts +41 -0
  45. package/dist/v5/node-source.d.ts +47 -0
  46. package/dist/v5/node.cjs +913 -0
  47. package/dist/v5/node.d.ts +6 -0
  48. package/dist/v5/node.js +890 -0
  49. package/dist/v5/point-cloud-attributes.d.ts +19 -0
  50. package/dist/v5/point-cloud-conversion.d.ts +1 -1
  51. package/dist/v5/point-cloud-copc.d.ts +44 -0
  52. package/dist/v5/point-cloud-file.d.ts +83 -0
  53. package/dist/v5/point-cloud-potree.d.ts +47 -0
  54. package/dist/v5/point-cloud-source-encoder.d.ts +1 -1
  55. package/dist/v5/point-cloud-source.d.ts +1 -1
  56. package/dist/v5/point-cloud-tileset.d.ts +44 -0
  57. package/dist/v5/point-cloud.d.ts +1 -1
  58. package/dist/v5/resource-manifest.d.ts +10 -1
  59. package/dist/v5/selected-mesh-source.d.ts +53 -0
  60. package/dist/v5/spatial-conversion.d.ts +1 -1
  61. package/dist/v5/tileset-source.d.ts +1 -1
  62. package/package.json +25 -32
  63. package/src/index.ts +4 -1
  64. package/src/v4/3d-tiles-converter/3d-tiles-converter.ts +11 -12
  65. package/src/v4/3d-tiles-converter/helpers/3d-tiles-content-converter.ts +7 -3
  66. package/src/v4/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts +2 -2
  67. package/src/v4/3d-tiles-converter/helpers/load-i3s.ts +4 -6
  68. package/src/v4/3d-tiles-converter/helpers/texture-atlas.ts +1 -1
  69. package/src/v4/3d-tiles-converter/helpers/validate-i3s-spatial-reference.ts +2 -2
  70. package/src/v4/3d-tiles-converter/json-templates/tileset.ts +58 -39
  71. package/src/v4/converter-cli.ts +10 -4
  72. package/src/v4/deps-installer/deps-installer.ts +3 -3
  73. package/src/v4/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
  74. package/src/v4/i3s-converter/helpers/batch-ids-extensions.ts +9 -10
  75. package/src/v4/i3s-converter/helpers/conversion-gltf.ts +108 -0
  76. package/src/v4/i3s-converter/helpers/coordinate-converter.ts +6 -5
  77. package/src/v4/i3s-converter/helpers/create-scene-server-path.ts +5 -6
  78. package/src/v4/i3s-converter/helpers/feature-attributes.ts +4 -4
  79. package/src/v4/i3s-converter/helpers/geometry-attributes.ts +1 -1
  80. package/src/v4/i3s-converter/helpers/geometry-converter.ts +69 -77
  81. package/src/v4/i3s-converter/helpers/gltf-attributes.ts +58 -74
  82. package/src/v4/i3s-converter/helpers/load-3d-tiles.ts +6 -54
  83. package/src/v4/i3s-converter/helpers/node-debug.ts +7 -3
  84. package/src/v4/i3s-converter/helpers/node-index-document.ts +11 -9
  85. package/src/v4/i3s-converter/helpers/node-pages.ts +3 -4
  86. package/src/v4/i3s-converter/helpers/preprocess-3d-tiles.ts +2 -2
  87. package/src/v4/i3s-converter/helpers/tileset-traversal.ts +1 -1
  88. package/src/v4/i3s-converter/i3s-converter.ts +29 -31
  89. package/src/v4/i3s-converter/json-templates/geometry-definitions.ts +71 -66
  90. package/src/v4/i3s-converter/json-templates/layers.ts +97 -132
  91. package/src/v4/i3s-converter/json-templates/metadata.ts +31 -21
  92. package/src/v4/i3s-converter/json-templates/node.ts +60 -74
  93. package/src/v4/i3s-converter/json-templates/scene-server.ts +36 -27
  94. package/src/v4/i3s-converter/json-templates/shared-resources.ts +62 -123
  95. package/src/v4/i3s-converter/json-templates/store.ts +39 -57
  96. package/src/v4/i3s-converter/types.ts +4 -4
  97. package/src/v4/i3s-server/controllers/slpk-controller.ts +3 -3
  98. package/src/v4/i3s-server/utils/create-scene-server.ts +3 -3
  99. package/src/v4/lib/utils/builder-input.ts +8 -0
  100. package/src/v4/lib/utils/conversion-dump.ts +5 -1
  101. package/src/v4/lib/utils/file-utils.ts +1 -1
  102. package/src/v4/lib/utils/hash-string.ts +21 -0
  103. package/src/v4/lib/utils/lod-conversion-utils.ts +3 -3
  104. package/src/v4/pgm-loader.ts +2 -2
  105. package/src/v5/adapters.ts +53 -0
  106. package/src/v5/archive-source.ts +235 -0
  107. package/src/v5/browser-tileset-source.ts +418 -48
  108. package/src/v5/browser.ts +46 -0
  109. package/src/v5/conversion-api.ts +184 -17
  110. package/src/v5/conversion-archive.ts +2 -2
  111. package/src/v5/converter-cli.ts +28 -0
  112. package/src/v5/core.ts +7 -0
  113. package/src/v5/feature-arrow.ts +2 -2
  114. package/src/v5/i3s-mesh-conversion.ts +41 -3
  115. package/src/v5/i3s-mesh-sink.ts +1 -1
  116. package/src/v5/i3s-mesh-source-features.ts +3 -3
  117. package/src/v5/i3s-mesh-source-material.ts +18 -11
  118. package/src/v5/i3s-mesh-source.ts +3 -2
  119. package/src/v5/i3s-selection-source.ts +298 -0
  120. package/src/v5/index.ts +41 -0
  121. package/src/v5/mesh-conversion.ts +24 -4
  122. package/src/v5/mesh-draco.ts +2 -2
  123. package/src/v5/mesh-features.ts +3 -3
  124. package/src/v5/mesh-hierarchy.ts +648 -0
  125. package/src/v5/mesh-source-features.ts +165 -51
  126. package/src/v5/mesh-source-schema.ts +140 -0
  127. package/src/v5/mesh-source-texture.ts +49 -19
  128. package/src/v5/mesh-source.ts +80 -49
  129. package/src/v5/mesh-tileset-archive.ts +1 -1
  130. package/src/v5/mesh-tileset-sink.ts +2 -2
  131. package/src/v5/mesh.ts +1 -1
  132. package/src/v5/node-cli.ts +201 -0
  133. package/src/v5/node-conversion.ts +362 -0
  134. package/src/v5/node-feature-schema.ts +155 -0
  135. package/src/v5/node-i3s-source.ts +181 -0
  136. package/src/v5/node-source.ts +328 -0
  137. package/src/v5/node.ts +16 -0
  138. package/src/v5/point-cloud-attributes.ts +113 -0
  139. package/src/v5/point-cloud-conversion.ts +1 -1
  140. package/src/v5/point-cloud-copc.ts +289 -0
  141. package/src/v5/point-cloud-file.ts +306 -0
  142. package/src/v5/point-cloud-potree.ts +134 -0
  143. package/src/v5/point-cloud-source-encoder.ts +1 -1
  144. package/src/v5/point-cloud-source.ts +1 -1
  145. package/src/v5/point-cloud-spatial.ts +2 -2
  146. package/src/v5/point-cloud-tileset.ts +137 -0
  147. package/src/v5/point-cloud.ts +3 -3
  148. package/src/v5/resource-fetcher.ts +4 -1
  149. package/src/v5/resource-manifest.ts +40 -5
  150. package/src/v5/selected-mesh-source.ts +384 -0
  151. package/src/v5/spatial-conversion.ts +90 -19
  152. package/src/v5/tileset-source.ts +2 -2
@@ -1,45 +1,56 @@
1
- import transform from 'json-map-transform';
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
2
4
 
3
- const COORDINATES = () => ({
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
- const HREF = () => ({
13
- href: {
14
- path: 'href'
15
- }
16
- });
7
+ import type {BoundingVolumes, NodeReference, Node3DIndexDocument} from '@loaders.gl/tiles-3d/i3s';
17
8
 
18
- const PARENT_NODE = () => ({
19
- id: {
20
- path: 'id'
21
- },
22
- ...HREF(),
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
- export const NODE = () => ({
27
- version: {
28
- path: 'version'
29
- },
30
- id: {
31
- path: 'id'
32
- },
33
- path: {
34
- path: 'path'
35
- },
36
- level: {
37
- path: 'level'
38
- },
39
- ...COORDINATES(),
40
- lodSelection: {
41
- path: 'lodSelection',
42
- default: [
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
- children: {
54
- path: 'children',
55
- default: null
56
- },
57
- neighbors: {
58
- path: 'neighbors',
59
- default: null
60
- },
61
- parentNode: {
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
- export const SCENE_SERVER = () => ({
2
- serviceItemId: {
3
- path: 'serviceItemId'
4
- },
5
- serviceName: {
6
- path: 'layerName'
7
- },
8
- name: {
9
- path: 'layerName'
10
- },
11
- currentVersion: {
12
- path: 'currentVersion',
13
- default: 10.7
14
- },
15
- serviceVersion: {
16
- path: 'serviceVersion',
17
- default: '1.8'
18
- },
19
- supportedBindings: {
20
- path: 'supportedBindings',
21
- default: ['REST']
22
- },
23
- layers: {
24
- path: 'layers0',
25
- transform: layers0 => [layers0]
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
- import transform from 'json-map-transform';
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
2
4
 
3
- const MATERIAL_DEFINITION_INFO_PARAMS = () => ({
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
- const MATERIAL_DEFINITION_INFO = () => ({
43
- name: {
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
- const TEXTURE_DEFINITION_IMAGE = () => ({
59
- id: {
60
- path: 'id'
61
- },
62
- size: {
63
- path: 'size'
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
- const TEXTURE_DEFINITION_INFO = () => ({
75
- encoding: {
76
- path: 'encoding'
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
- export const SHARED_RESOURCES = () => ({
102
- materialDefinitions: {
103
- path: 'materialDefinitionInfos',
104
- transform: transfromMaterialDefinitions
105
- },
106
- textureDefinitions: {
107
- path: 'textureDefinitionInfos',
108
- transform: transfromTextureDefinitions
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
- function transfromMaterialDefinitions(materialDefinitionInfos, thisObject, originalObject) {
113
- const result = {};
114
- for (const [index, materialDefinitionInfo] of materialDefinitionInfos.entries()) {
115
- result[`Mat${originalObject.nodePath}${index}`] = transform(
116
- materialDefinitionInfo,
117
- MATERIAL_DEFINITION_INFO()
118
- );
119
- }
120
- return result;
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
- function transfromTextureDefinitions(textureDefinitionInfos, thisObject, originalObject) {
124
- if (!textureDefinitionInfos) {
125
- return null;
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 result = {};
128
- for (const [index, textureDefinitionInfo] of textureDefinitionInfos.entries()) {
129
- const imageIndex = `${originalObject.nodePath}${index}`;
130
- textureDefinitionInfo.imageIndex = imageIndex;
131
- result[imageIndex] = transform(textureDefinitionInfo, TEXTURE_DEFINITION_INFO());
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 result;
72
+ return {materialDefinitions, textureDefinitions};
134
73
  }
@@ -1,58 +1,40 @@
1
- export const STORE = {
2
- id: {
3
- path: 'id',
4
- transform: val => val.toUpperCase()
5
- },
6
- profile: {
7
- path: 'profile',
8
- default: 'meshpyramids'
9
- },
10
- version: {
11
- path: 'version',
12
- default: '1.8'
13
- },
14
- resourcePattern: {
15
- path: 'resourcePattern',
16
- default: ['3dNodeIndexDocument', 'Attributes', 'SharedResource', 'Geometry']
17
- },
18
- rootNode: {
19
- path: 'rootNode',
20
- default: './nodes/root'
21
- },
22
- extent: {
23
- path: 'extent'
24
- },
25
- indexCRS: {
26
- path: 'indexCRS',
27
- default: 'http://www.opengis.net/def/crs/EPSG/0/4326'
28
- },
29
- vertexCRS: {
30
- path: 'vertexCRS',
31
- default: 'http://www.opengis.net/def/crs/EPSG/0/4326'
32
- },
33
- normalReferenceFrame: {
34
- path: 'normalReferenceFrame',
35
- default: 'east-north-up'
36
- },
37
- attributeEncoding: {
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 {GLTFImagePostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';
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?: GLTFImagePostprocessed;
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: GLTFNodePostprocessed[];
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 {v4 as uuidv4} from 'uuid';
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: uuidv4().replace(/-/gi, ''),
12
+ serviceItemId: randomUUID().replace(/-/gi, ''),
13
13
  serviceName: name,
14
14
  name,
15
15
  currentVersion: '10.7',
@@ -0,0 +1,8 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ /** Partial converter input; missing and null fields both select legacy defaults. */
6
+ export type BuilderInput<T> = {
7
+ [Property in keyof T]?: T[Property] | null;
8
+ };
@@ -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 {BoundingVolumes, I3SMaterialDefinition, TextureSetDefinitionFormats} from '@loaders.gl/i3s';
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/src/types';
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;
@@ -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__'.