@loaders.gl/tile-converter 4.0.0-alpha.12 → 4.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/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +8 -19
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +4 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/converter.min.js +66 -66
- package/dist/dist.min.js +1381 -331
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +34 -67
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +6 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +10 -21
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +8 -18
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +6 -0
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +0 -7
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +3 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +2 -2
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +0 -5
- package/dist/i3s-converter/types.d.ts +32 -1
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-converter/types.js +1 -1
- package/package.json +16 -18
- package/src/3d-tiles-converter/3d-tiles-converter.ts +10 -28
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +5 -2
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +6 -6
- package/src/i3s-converter/helpers/geometry-converter.ts +17 -17
- package/src/i3s-converter/helpers/gltf-attributes.ts +2 -2
- package/src/i3s-converter/i3s-converter.ts +0 -5
- package/src/i3s-converter/types.ts +32 -1
- package/dist/3d-tiles-attributes-worker.d.ts +0 -28
- package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/3d-tiles-attributes-worker.js +0 -3
- package/dist/3d-tiles-attributes-worker.js.map +0 -7
- package/dist/es5/3d-tiles-attributes-worker.js +0 -25
- package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-attributes-worker.js +0 -25
- package/dist/es5/i3s-attributes-worker.js.map +0 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/workers/i3s-attributes-worker.js +0 -30
- package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/3d-tiles-attributes-worker.js +0 -16
- package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-attributes-worker.js +0 -16
- package/dist/esm/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/workers/i3s-attributes-worker.js +0 -7
- package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/i3s-attributes-worker.d.ts +0 -45
- package/dist/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/i3s-attributes-worker.js +0 -9
- package/dist/i3s-attributes-worker.js.map +0 -7
- package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/workers/3d-tiles-attributes-worker.js +0 -9
- package/dist/workers/i3s-attributes-worker.d.ts +0 -2
- package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/workers/i3s-attributes-worker.js +0 -5
- package/src/3d-tiles-attributes-worker.ts +0 -43
- package/src/i3s-attributes-worker.ts +0 -59
- package/src/workers/3d-tiles-attributes-worker.ts +0 -6
- package/src/workers/i3s-attributes-worker.ts +0 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { GLTFImagePostprocessed } from '@loaders.gl/gltf';
|
|
1
|
+
import { GLTFImagePostprocessed, GLTFNodePostprocessed } from '@loaders.gl/gltf';
|
|
2
2
|
import { BoundingVolumes, I3SMaterialDefinition, MaterialDefinitionInfo, TextureDefinitionInfo } from '@loaders.gl/i3s';
|
|
3
|
+
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
3
4
|
/** Converted resources for specific node */
|
|
4
5
|
export type I3SConvertedResources = {
|
|
5
6
|
/**
|
|
@@ -160,4 +161,34 @@ export type PreprocessData = {
|
|
|
160
161
|
/** Mesh topology types used in gltf primitives of the tileset */
|
|
161
162
|
meshTopologyTypes: Set<GltfPrimitiveModeString>;
|
|
162
163
|
};
|
|
164
|
+
/** Texture image properties required for conversion */
|
|
165
|
+
export type TextureImageProperties = {
|
|
166
|
+
/** Array with image data */
|
|
167
|
+
data: Uint8Array;
|
|
168
|
+
/** Is the texture compressed */
|
|
169
|
+
compressed?: boolean;
|
|
170
|
+
/** Height of the texture's image */
|
|
171
|
+
height?: number;
|
|
172
|
+
/** Width of the texture's image */
|
|
173
|
+
width?: number;
|
|
174
|
+
/** Number of components (3 for RGB, 4 for RGBA) */
|
|
175
|
+
components?: number;
|
|
176
|
+
/** Mime type of the texture's image */
|
|
177
|
+
mimeType?: string;
|
|
178
|
+
};
|
|
179
|
+
/** glTF attributes data, prepared for conversion */
|
|
180
|
+
export type GLTFAttributesData = {
|
|
181
|
+
/** glTF PBR materials (only id is required) */
|
|
182
|
+
gltfMaterials?: {
|
|
183
|
+
id: string;
|
|
184
|
+
}[];
|
|
185
|
+
/** glTF geometry nodes */
|
|
186
|
+
nodes: GLTFNodePostprocessed[];
|
|
187
|
+
/** glTF texture images (set to null for compressed textures) */
|
|
188
|
+
images: (null | TextureImageProperties)[];
|
|
189
|
+
/** Source tile origin coordinates in cartographic coordinate system */
|
|
190
|
+
cartographicOrigin: Vector3;
|
|
191
|
+
/** Model matrix to convert coordinate system of POSITION and NORMAL attributes from METER_OFFSETS to CARTESIAN */
|
|
192
|
+
cartesianModelMatrix: Matrix4;
|
|
193
|
+
};
|
|
163
194
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/types.ts"],"names":[],"mappings":"AAAA,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oD;AACpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+CAA+C;IAC/C,aAAa,CAAC,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAC/B,0BAA0B;IAC1B,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,gEAAgE;IAChE,MAAM,EAAE,CAAC,IAAI,GAAG,sBAAsB,CAAC,EAAE,CAAC;IAC1C,uEAAuE;IACvE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mHAAmH;IACnH,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC"}
|
|
@@ -14,4 +14,4 @@ var GltfPrimitiveModeString;
|
|
|
14
14
|
GltfPrimitiveModeString["TRIANGLES"] = "TRIANGLES";
|
|
15
15
|
GltfPrimitiveModeString["TRIANGLE_STRIP"] = "TRIANGLE_STRIP";
|
|
16
16
|
GltfPrimitiveModeString["TRIANGLE_FAN"] = "TRIANGLE_FAN";
|
|
17
|
-
})(GltfPrimitiveModeString
|
|
17
|
+
})(GltfPrimitiveModeString || (exports.GltfPrimitiveModeString = GltfPrimitiveModeString = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.14",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,26 +38,24 @@
|
|
|
38
38
|
"join-images": false
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"pre-build": "npm run build-bundle && npm run build-converter-bundle && npm run build-
|
|
41
|
+
"pre-build": "npm run build-bundle && npm run build-converter-bundle && npm run build-slpk-extractor-bundle",
|
|
42
42
|
"build-bundle": "esbuild ./src/index.ts --bundle --outfile=dist/dist.min.js --platform=node --external:join-images",
|
|
43
43
|
"build-converter-bundle": "esbuild src/converter-cli.ts --outfile=dist/converter.min.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
44
|
-
"build-slpk-extractor-bundle": "esbuild src/slpk-extractor-cli.ts --outfile=dist/slpk-extractor.min.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
45
|
-
"build-i3s-attributes-worker": "esbuild src/workers/i3s-attributes-worker.ts --outfile=dist/i3s-attributes-worker.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
46
|
-
"build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
44
|
+
"build-slpk-extractor-bundle": "esbuild src/slpk-extractor-cli.ts --outfile=dist/slpk-extractor.min.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
47
45
|
},
|
|
48
46
|
"dependencies": {
|
|
49
|
-
"@loaders.gl/3d-tiles": "4.0.0-alpha.
|
|
50
|
-
"@loaders.gl/crypto": "4.0.0-alpha.
|
|
51
|
-
"@loaders.gl/draco": "4.0.0-alpha.
|
|
52
|
-
"@loaders.gl/gltf": "4.0.0-alpha.
|
|
53
|
-
"@loaders.gl/i3s": "4.0.0-alpha.
|
|
54
|
-
"@loaders.gl/images": "4.0.0-alpha.
|
|
55
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
56
|
-
"@loaders.gl/polyfills": "4.0.0-alpha.
|
|
57
|
-
"@loaders.gl/textures": "4.0.0-alpha.
|
|
58
|
-
"@loaders.gl/tiles": "4.0.0-alpha.
|
|
59
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
60
|
-
"@loaders.gl/zip": "4.0.0-alpha.
|
|
47
|
+
"@loaders.gl/3d-tiles": "4.0.0-alpha.14",
|
|
48
|
+
"@loaders.gl/crypto": "4.0.0-alpha.14",
|
|
49
|
+
"@loaders.gl/draco": "4.0.0-alpha.14",
|
|
50
|
+
"@loaders.gl/gltf": "4.0.0-alpha.14",
|
|
51
|
+
"@loaders.gl/i3s": "4.0.0-alpha.14",
|
|
52
|
+
"@loaders.gl/images": "4.0.0-alpha.14",
|
|
53
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.14",
|
|
54
|
+
"@loaders.gl/polyfills": "4.0.0-alpha.14",
|
|
55
|
+
"@loaders.gl/textures": "4.0.0-alpha.14",
|
|
56
|
+
"@loaders.gl/tiles": "4.0.0-alpha.14",
|
|
57
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.14",
|
|
58
|
+
"@loaders.gl/zip": "4.0.0-alpha.14",
|
|
61
59
|
"@math.gl/core": "^3.5.1",
|
|
62
60
|
"@math.gl/culling": "^3.5.1",
|
|
63
61
|
"@math.gl/geoid": "^3.5.1",
|
|
@@ -80,5 +78,5 @@
|
|
|
80
78
|
"join-images": "^1.1.3",
|
|
81
79
|
"sharp": "^0.31.3"
|
|
82
80
|
},
|
|
83
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "dd885592142ad9c26fc38e0eb0a711cf4806345a"
|
|
84
82
|
}
|
|
@@ -4,7 +4,7 @@ import type {Tiles3DTileJSON} from '@loaders.gl/3d-tiles';
|
|
|
4
4
|
import {join} from 'path';
|
|
5
5
|
import process from 'process';
|
|
6
6
|
import transform from 'json-map-transform';
|
|
7
|
-
import {
|
|
7
|
+
import {load, isBrowser} from '@loaders.gl/core';
|
|
8
8
|
import {I3SLoader, I3SAttributeLoader, COORDINATE_SYSTEM} from '@loaders.gl/i3s';
|
|
9
9
|
import {Tileset3D, Tile3D} from '@loaders.gl/tiles';
|
|
10
10
|
import {Geoid} from '@math.gl/geoid';
|
|
@@ -16,13 +16,9 @@ import {writeFile, removeDir} from '../lib/utils/file-utils';
|
|
|
16
16
|
import {calculateFilesSize, timeConverter} from '../lib/utils/statistic-utills';
|
|
17
17
|
import {TILESET as tilesetTemplate} from './json-templates/tileset';
|
|
18
18
|
import {createObbFromMbs} from '../i3s-converter/helpers/coordinate-converter';
|
|
19
|
-
import {
|
|
20
|
-
I3SAttributesData,
|
|
21
|
-
Tile3dAttributesWorker,
|
|
22
|
-
transform3DTilesAttributesOnWorker
|
|
23
|
-
} from '../3d-tiles-attributes-worker';
|
|
24
|
-
import {getWorkerURL, WorkerFarm} from '@loaders.gl/worker-utils';
|
|
19
|
+
import {WorkerFarm} from '@loaders.gl/worker-utils';
|
|
25
20
|
import {BROWSER_ERROR_MESSAGE} from '../constants';
|
|
21
|
+
import B3dmConverter, {I3SAttributesData} from './helpers/b3dm-converter';
|
|
26
22
|
|
|
27
23
|
const I3S = 'I3S';
|
|
28
24
|
|
|
@@ -78,19 +74,17 @@ export default class Tiles3DConverter {
|
|
|
78
74
|
this.geoidHeightModel = await load(egmFilePath, PGMLoader);
|
|
79
75
|
console.log('Loading egm file completed!'); // eslint-disable-line
|
|
80
76
|
|
|
81
|
-
await this.loadWorkers();
|
|
82
|
-
|
|
83
77
|
const sourceTilesetJson = await load(inputUrl, I3SLoader, {});
|
|
84
78
|
|
|
85
79
|
this.sourceTileset = new Tileset3D(sourceTilesetJson, {
|
|
86
80
|
loadOptions: {
|
|
87
81
|
_nodeWorkers: true,
|
|
88
82
|
reuseWorkers: true,
|
|
89
|
-
i3s: {coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false}
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
i3s: {coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false},
|
|
84
|
+
// We need to load local fs workers because nodejs can't load workers from the Internet
|
|
85
|
+
'i3s-content': {
|
|
86
|
+
workerUrl: './modules/i3s/dist/i3s-content-worker-node.js'
|
|
87
|
+
}
|
|
94
88
|
}
|
|
95
89
|
});
|
|
96
90
|
|
|
@@ -171,10 +165,8 @@ export default class Tiles3DConverter {
|
|
|
171
165
|
textureFormat: sourceChild?.header?.textureFormat
|
|
172
166
|
};
|
|
173
167
|
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
featureAttributes
|
|
177
|
-
});
|
|
168
|
+
const b3dmConverter = new B3dmConverter();
|
|
169
|
+
const b3dm = await b3dmConverter.convert(i3sAttributesData, featureAttributes);
|
|
178
170
|
|
|
179
171
|
child.content = {
|
|
180
172
|
uri: `${sourceChild.id}.b3dm`,
|
|
@@ -342,14 +334,4 @@ export default class Tiles3DConverter {
|
|
|
342
334
|
console.log(`File(s) size: `, filesSize, ' bytes'); // eslint-disable-line
|
|
343
335
|
console.log(`------------------------------------------------`); // eslint-disable-line
|
|
344
336
|
}
|
|
345
|
-
|
|
346
|
-
private async loadWorkers(): Promise<void> {
|
|
347
|
-
console.log(`Loading workers source...`); // eslint-disable-line no-undef, no-console
|
|
348
|
-
const tile3dAttributesWorkerUrl = getWorkerURL(Tile3dAttributesWorker, {...getLoaderOptions()});
|
|
349
|
-
const sourceResponse = await fetchFile(tile3dAttributesWorkerUrl);
|
|
350
|
-
const source = await sourceResponse.text();
|
|
351
|
-
|
|
352
|
-
this.workerSource.tile3dWorkerSource = source;
|
|
353
|
-
console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console
|
|
354
|
-
}
|
|
355
337
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {I3SAttributesData} from '../../3d-tiles-attributes-worker';
|
|
2
|
-
|
|
3
1
|
import {encodeSync} from '@loaders.gl/core';
|
|
4
2
|
import {GLTFScenegraph, GLTFWriter} from '@loaders.gl/gltf';
|
|
5
3
|
import {Tile3DWriter} from '@loaders.gl/3d-tiles';
|
|
@@ -11,6 +9,11 @@ import {generateSyntheticIndices} from '../../lib/utils/geometry-utils';
|
|
|
11
9
|
const Z_UP_TO_Y_UP_MATRIX = new Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
|
|
12
10
|
const scratchVector = new Vector3();
|
|
13
11
|
|
|
12
|
+
export type I3SAttributesData = {
|
|
13
|
+
tileContent: any;
|
|
14
|
+
textureFormat: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
14
17
|
/**
|
|
15
18
|
* Converts content of an I3S node to *.b3dm's file content
|
|
16
19
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {GLTFAccessorPostprocessed, GLTFMeshPrimitivePostprocessed} from '@loaders.gl/gltf';
|
|
2
2
|
import type {NumericArray} from '@loaders.gl/loader-utils';
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
GLTF_EXT_feature_metadata_FeatureIdTexture,
|
|
5
|
+
GLTF_EXT_feature_metadata_Primitive
|
|
6
6
|
} from '@loaders.gl/gltf';
|
|
7
7
|
import {TypedArray} from '@math.gl/core';
|
|
8
|
-
import {TextureImageProperties} from '
|
|
8
|
+
import {TextureImageProperties} from '../types';
|
|
9
9
|
|
|
10
10
|
const EXT_MESH_FEATURES = 'EXT_mesh_features';
|
|
11
11
|
const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
|
|
@@ -34,7 +34,7 @@ export function handleBatchIdsExtensions(
|
|
|
34
34
|
case EXT_FEATURE_METADATA:
|
|
35
35
|
return handleExtFeatureMetadataExtension(
|
|
36
36
|
attributes,
|
|
37
|
-
extensionData as
|
|
37
|
+
extensionData as GLTF_EXT_feature_metadata_Primitive,
|
|
38
38
|
images
|
|
39
39
|
);
|
|
40
40
|
case EXT_MESH_FEATURES:
|
|
@@ -59,7 +59,7 @@ function handleExtFeatureMetadataExtension(
|
|
|
59
59
|
attributes: {
|
|
60
60
|
[key: string]: GLTFAccessorPostprocessed;
|
|
61
61
|
},
|
|
62
|
-
extFeatureMetadata:
|
|
62
|
+
extFeatureMetadata: GLTF_EXT_feature_metadata_Primitive,
|
|
63
63
|
images: (TextureImageProperties | null)[]
|
|
64
64
|
): NumericArray {
|
|
65
65
|
// Take only first extension object to get batchIds attribute name.
|
|
@@ -146,7 +146,7 @@ function generateImplicitFeatureIds(
|
|
|
146
146
|
* @param featureIdTextures
|
|
147
147
|
*/
|
|
148
148
|
function generateBatchIdsFromTexture(
|
|
149
|
-
featureIdTexture:
|
|
149
|
+
featureIdTexture: GLTF_EXT_feature_metadata_FeatureIdTexture,
|
|
150
150
|
textureCoordinates: TypedArray,
|
|
151
151
|
images: (TextureImageProperties | null)[]
|
|
152
152
|
) {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type {FeatureTableJson, Tiles3DTileContent} from '@loaders.gl/3d-tiles';
|
|
2
2
|
import type {
|
|
3
|
-
GLTF_EXT_feature_metadata,
|
|
4
|
-
GLTF_EXT_mesh_features,
|
|
5
3
|
GLTFAccessorPostprocessed,
|
|
6
4
|
GLTFMaterialPostprocessed,
|
|
7
5
|
GLTFNodePostprocessed,
|
|
8
6
|
GLTFMeshPrimitivePostprocessed,
|
|
9
7
|
GLTFMeshPostprocessed,
|
|
10
|
-
GLTFTexturePostprocessed
|
|
8
|
+
GLTFTexturePostprocessed,
|
|
9
|
+
GLTF_EXT_feature_metadata_GLTF
|
|
11
10
|
} from '@loaders.gl/gltf';
|
|
12
11
|
|
|
13
12
|
import {Vector3, Matrix4, Vector4} from '@math.gl/core';
|
|
@@ -35,11 +34,6 @@ import {
|
|
|
35
34
|
} from '@loaders.gl/i3s';
|
|
36
35
|
import {NumberArray, TypedArray} from '@loaders.gl/loader-utils';
|
|
37
36
|
import {Geoid} from '@math.gl/geoid';
|
|
38
|
-
/** Usage of worker here brings more overhead than advantage */
|
|
39
|
-
import {
|
|
40
|
-
B3DMAttributesData /*, transformI3SAttributesOnWorker*/,
|
|
41
|
-
TextureImageProperties
|
|
42
|
-
} from '../../i3s-attributes-worker';
|
|
43
37
|
import {prepareDataForAttributesConversion} from './gltf-attributes';
|
|
44
38
|
import {handleBatchIdsExtensions} from './batch-ids-extensions';
|
|
45
39
|
import {checkPropertiesLength, flattenPropertyTableByFeatureIds} from './feature-attributes';
|
|
@@ -50,7 +44,7 @@ import {GL} from '@loaders.gl/math';
|
|
|
50
44
|
So the following import is replaced with the local import
|
|
51
45
|
import type {TypedArrayConstructor} from '@math.gl/types';
|
|
52
46
|
*/
|
|
53
|
-
import type {TypedArrayConstructor} from '../types';
|
|
47
|
+
import type {GLTFAttributesData, TextureImageProperties, TypedArrayConstructor} from '../types';
|
|
54
48
|
import {generateSyntheticIndices} from '../../lib/utils/geometry-utils';
|
|
55
49
|
import {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';
|
|
56
50
|
|
|
@@ -321,7 +315,7 @@ async function _makeNodeResources({
|
|
|
321
315
|
* @returns map of converted geometry attributes
|
|
322
316
|
*/
|
|
323
317
|
export async function convertAttributes(
|
|
324
|
-
attributesData:
|
|
318
|
+
attributesData: GLTFAttributesData,
|
|
325
319
|
materialAndTextureList: I3SMaterialWithTexture[],
|
|
326
320
|
useCartesianPositions: boolean
|
|
327
321
|
): Promise<Map<string, ConvertedAttributes>> {
|
|
@@ -1577,7 +1571,7 @@ export function getPropertyTable(tileContent: Tiles3DTileContent | null): Featur
|
|
|
1577
1571
|
return null;
|
|
1578
1572
|
}
|
|
1579
1573
|
case EXT_FEATURE_METADATA: {
|
|
1580
|
-
return getPropertyTableFromExtFeatureMetadata(extension as
|
|
1574
|
+
return getPropertyTableFromExtFeatureMetadata(extension as GLTF_EXT_feature_metadata_GLTF);
|
|
1581
1575
|
}
|
|
1582
1576
|
default:
|
|
1583
1577
|
return null;
|
|
@@ -1588,9 +1582,10 @@ export function getPropertyTable(tileContent: Tiles3DTileContent | null): Featur
|
|
|
1588
1582
|
* Check extensions which can be with property table inside.
|
|
1589
1583
|
* @param tileContent - 3DTiles tile content
|
|
1590
1584
|
*/
|
|
1591
|
-
function getPropertyTableExtension(
|
|
1592
|
-
|
|
1593
|
-
|
|
1585
|
+
function getPropertyTableExtension(tileContent: Tiles3DTileContent): {
|
|
1586
|
+
extensionName: null | string;
|
|
1587
|
+
extension: string | GLTF_EXT_feature_metadata_GLTF | null;
|
|
1588
|
+
} {
|
|
1594
1589
|
const extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
|
|
1595
1590
|
const extensionsUsed = tileContent?.gltf?.extensionsUsed;
|
|
1596
1591
|
|
|
@@ -1599,7 +1594,6 @@ function getPropertyTableExtension(
|
|
|
1599
1594
|
}
|
|
1600
1595
|
|
|
1601
1596
|
let extensionName: string = '';
|
|
1602
|
-
|
|
1603
1597
|
for (const extensionItem of tileContent?.gltf?.extensionsUsed || []) {
|
|
1604
1598
|
if (extensionsWithPropertyTables.includes(extensionItem)) {
|
|
1605
1599
|
extensionName = extensionItem;
|
|
@@ -1607,7 +1601,13 @@ function getPropertyTableExtension(
|
|
|
1607
1601
|
}
|
|
1608
1602
|
}
|
|
1609
1603
|
|
|
1610
|
-
|
|
1604
|
+
if (!extensionName) {
|
|
1605
|
+
return {extensionName: null, extension: null};
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
const extension = tileContent?.gltf?.extensions?.[extensionName] as
|
|
1609
|
+
| string // EXT_mesh_features doesn't have global metadata
|
|
1610
|
+
| GLTF_EXT_feature_metadata_GLTF;
|
|
1611
1611
|
|
|
1612
1612
|
return {extensionName, extension};
|
|
1613
1613
|
}
|
|
@@ -1617,7 +1617,7 @@ function getPropertyTableExtension(
|
|
|
1617
1617
|
* @param extension
|
|
1618
1618
|
*/
|
|
1619
1619
|
function getPropertyTableFromExtFeatureMetadata(
|
|
1620
|
-
extension:
|
|
1620
|
+
extension: GLTF_EXT_feature_metadata_GLTF
|
|
1621
1621
|
): FeatureTableJson | null {
|
|
1622
1622
|
if (extension?.featureTables) {
|
|
1623
1623
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {Tiles3DTileContent} from '@loaders.gl/3d-tiles';
|
|
2
2
|
import type {GLTFAccessorPostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';
|
|
3
|
-
import type {B3DMAttributesData} from '../../i3s-attributes-worker';
|
|
4
3
|
import {Matrix4, TypedArray, Vector3} from '@math.gl/core';
|
|
5
4
|
import {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';
|
|
6
5
|
import {Ellipsoid} from '@math.gl/geospatial';
|
|
6
|
+
import {GLTFAttributesData} from '../types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Prepare attributes for conversion to avoid binary data breaking in worker thread.
|
|
@@ -17,7 +17,7 @@ export function prepareDataForAttributesConversion(
|
|
|
17
17
|
tileContent: Tiles3DTileContent,
|
|
18
18
|
tileTransform: Matrix4,
|
|
19
19
|
boundingVolume: OrientedBoundingBox | BoundingSphere
|
|
20
|
-
):
|
|
20
|
+
): GLTFAttributesData {
|
|
21
21
|
let nodes =
|
|
22
22
|
tileContent.gltf?.scene?.nodes ||
|
|
23
23
|
tileContent.gltf?.scenes?.[0]?.nodes ||
|
|
@@ -59,7 +59,6 @@ import {
|
|
|
59
59
|
import {getWorkerURL, WorkerFarm} from '@loaders.gl/worker-utils';
|
|
60
60
|
import {DracoWriterWorker} from '@loaders.gl/draco';
|
|
61
61
|
import WriteQueue from '../lib/utils/write-queue';
|
|
62
|
-
import {I3SAttributesWorker} from '../i3s-attributes-worker';
|
|
63
62
|
import {BROWSER_ERROR_MESSAGE} from '../constants';
|
|
64
63
|
import {
|
|
65
64
|
createdStorageAttribute,
|
|
@@ -1211,10 +1210,6 @@ export default class I3SConverter {
|
|
|
1211
1210
|
this.workerSource.ktx2 = source;
|
|
1212
1211
|
}
|
|
1213
1212
|
|
|
1214
|
-
const i3sAttributesWorkerUrl = getWorkerURL(I3SAttributesWorker, {...getLoaderOptions()});
|
|
1215
|
-
const sourceResponse = await fetchFile(i3sAttributesWorkerUrl);
|
|
1216
|
-
const source = await sourceResponse.text();
|
|
1217
|
-
this.workerSource.I3SAttributes = source;
|
|
1218
1213
|
console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console
|
|
1219
1214
|
}
|
|
1220
1215
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {GLTFImagePostprocessed} from '@loaders.gl/gltf';
|
|
1
|
+
import {GLTFImagePostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';
|
|
2
2
|
import {
|
|
3
3
|
BoundingVolumes,
|
|
4
4
|
I3SMaterialDefinition,
|
|
5
5
|
MaterialDefinitionInfo,
|
|
6
6
|
TextureDefinitionInfo
|
|
7
7
|
} from '@loaders.gl/i3s';
|
|
8
|
+
import {Matrix4, Vector3} from '@math.gl/core';
|
|
8
9
|
|
|
9
10
|
/** Converted resources for specific node */
|
|
10
11
|
export type I3SConvertedResources = {
|
|
@@ -183,3 +184,33 @@ export type PreprocessData = {
|
|
|
183
184
|
/** Mesh topology types used in gltf primitives of the tileset */
|
|
184
185
|
meshTopologyTypes: Set<GltfPrimitiveModeString>;
|
|
185
186
|
};
|
|
187
|
+
|
|
188
|
+
/** Texture image properties required for conversion */
|
|
189
|
+
export type TextureImageProperties = {
|
|
190
|
+
/** Array with image data */
|
|
191
|
+
data: Uint8Array;
|
|
192
|
+
/** Is the texture compressed */
|
|
193
|
+
compressed?: boolean;
|
|
194
|
+
/** Height of the texture's image */
|
|
195
|
+
height?: number;
|
|
196
|
+
/** Width of the texture's image */
|
|
197
|
+
width?: number;
|
|
198
|
+
/** Number of components (3 for RGB, 4 for RGBA) */
|
|
199
|
+
components?: number;
|
|
200
|
+
/** Mime type of the texture's image */
|
|
201
|
+
mimeType?: string;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/** glTF attributes data, prepared for conversion */
|
|
205
|
+
export type GLTFAttributesData = {
|
|
206
|
+
/** glTF PBR materials (only id is required) */
|
|
207
|
+
gltfMaterials?: {id: string}[];
|
|
208
|
+
/** glTF geometry nodes */
|
|
209
|
+
nodes: GLTFNodePostprocessed[];
|
|
210
|
+
/** glTF texture images (set to null for compressed textures) */
|
|
211
|
+
images: (null | TextureImageProperties)[];
|
|
212
|
+
/** Source tile origin coordinates in cartographic coordinate system */
|
|
213
|
+
cartographicOrigin: Vector3;
|
|
214
|
+
/** Model matrix to convert coordinate system of POSITION and NORMAL attributes from METER_OFFSETS to CARTESIAN */
|
|
215
|
+
cartesianModelMatrix: Matrix4;
|
|
216
|
+
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { WorkerObject } from '@loaders.gl/worker-utils';
|
|
2
|
-
import type { FeatureAttribute } from '@loaders.gl/i3s';
|
|
3
|
-
export type Tile3DAttributesWorkerOptions = {
|
|
4
|
-
featureAttributes: FeatureAttribute | null;
|
|
5
|
-
source: string;
|
|
6
|
-
};
|
|
7
|
-
export type I3SAttributesData = {
|
|
8
|
-
tileContent: any;
|
|
9
|
-
textureFormat: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* I3S Attributes Worker to handle B3DM object
|
|
13
|
-
*/
|
|
14
|
-
export declare const Tile3dAttributesWorker: {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
module: string;
|
|
18
|
-
version: any;
|
|
19
|
-
options: {
|
|
20
|
-
featureAttributes: null;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Performs I3S attributes transformation
|
|
25
|
-
*/
|
|
26
|
-
export declare function transform3DTilesAttributesOnWorker(i3sAttributesData: I3SAttributesData, options: Tile3DAttributesWorkerOptions): Promise<ArrayBuffer>;
|
|
27
|
-
export declare const _typecheckI3SAttributesWorker: WorkerObject;
|
|
28
|
-
//# sourceMappingURL=3d-tiles-attributes-worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3d-tiles-attributes-worker.d.ts","sourceRoot":"","sources":["../src/3d-tiles-attributes-worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAQtD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,iBAAiB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,GAAG,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;CAQlC,CAAC;AAEF;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,eAAO,MAAM,6BAA6B,EAAE,YAAqC,CAAC"}
|