@loaders.gl/tile-converter 3.3.0-alpha.4 → 3.3.0-alpha.5
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-attributes-worker.d.ts +1 -1
- package/dist/3d-tiles-attributes-worker.js +2 -2
- package/dist/3d-tiles-attributes-worker.js.map +2 -2
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +21 -17
- package/dist/converter.min.js +1 -1
- package/dist/dist.min.js +2 -2
- package/dist/es5/3d-tiles-attributes-worker.js +2 -2
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +27 -19
- 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-attributes-worker.js +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +2 -2
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +25 -15
- 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-attributes-worker.js +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/i3s-attributes-worker.js.map +1 -1
- package/dist/workers/3d-tiles-attributes-worker.js +1 -1
- package/package.json +15 -15
- package/src/3d-tiles-attributes-worker.ts +1 -1
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +25 -18
- package/src/workers/3d-tiles-attributes-worker.ts +1 -1
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const worker_utils_1 = require("@loaders.gl/worker-utils");
|
|
7
7
|
const b3dm_converter_1 = __importDefault(require("../3d-tiles-converter/helpers/b3dm-converter"));
|
|
8
8
|
const b3dmConverter = new b3dm_converter_1.default();
|
|
9
|
-
(0, worker_utils_1.createWorker)(async (data, options = {}) => b3dmConverter.convert(data, options.
|
|
9
|
+
(0, worker_utils_1.createWorker)(async (data, options = {}) => b3dmConverter.convert(data, options.featureAttributes));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "3.3.0-alpha.
|
|
3
|
+
"version": "3.3.0-alpha.5",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node12 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@loaders.gl/3d-tiles": "3.3.0-alpha.
|
|
47
|
-
"@loaders.gl/crypto": "3.3.0-alpha.
|
|
48
|
-
"@loaders.gl/draco": "3.3.0-alpha.
|
|
49
|
-
"@loaders.gl/gltf": "3.3.0-alpha.
|
|
50
|
-
"@loaders.gl/i3s": "3.3.0-alpha.
|
|
51
|
-
"@loaders.gl/images": "3.3.0-alpha.
|
|
52
|
-
"@loaders.gl/loader-utils": "3.3.0-alpha.
|
|
53
|
-
"@loaders.gl/polyfills": "3.3.0-alpha.
|
|
54
|
-
"@loaders.gl/schema": "3.3.0-alpha.
|
|
55
|
-
"@loaders.gl/textures": "3.3.0-alpha.
|
|
56
|
-
"@loaders.gl/tiles": "3.3.0-alpha.
|
|
57
|
-
"@loaders.gl/worker-utils": "3.3.0-alpha.
|
|
58
|
-
"@loaders.gl/zip": "3.3.0-alpha.
|
|
46
|
+
"@loaders.gl/3d-tiles": "3.3.0-alpha.5",
|
|
47
|
+
"@loaders.gl/crypto": "3.3.0-alpha.5",
|
|
48
|
+
"@loaders.gl/draco": "3.3.0-alpha.5",
|
|
49
|
+
"@loaders.gl/gltf": "3.3.0-alpha.5",
|
|
50
|
+
"@loaders.gl/i3s": "3.3.0-alpha.5",
|
|
51
|
+
"@loaders.gl/images": "3.3.0-alpha.5",
|
|
52
|
+
"@loaders.gl/loader-utils": "3.3.0-alpha.5",
|
|
53
|
+
"@loaders.gl/polyfills": "3.3.0-alpha.5",
|
|
54
|
+
"@loaders.gl/schema": "3.3.0-alpha.5",
|
|
55
|
+
"@loaders.gl/textures": "3.3.0-alpha.5",
|
|
56
|
+
"@loaders.gl/tiles": "3.3.0-alpha.5",
|
|
57
|
+
"@loaders.gl/worker-utils": "3.3.0-alpha.5",
|
|
58
|
+
"@loaders.gl/zip": "3.3.0-alpha.5",
|
|
59
59
|
"@luma.gl/engine": "^8.5.4",
|
|
60
60
|
"@math.gl/core": "^3.5.1",
|
|
61
61
|
"@math.gl/culling": "^3.5.1",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@loaders.gl/core": "^3.2.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d2df3bead97710c45fd2974cd51ecd7d5f7f5ea4"
|
|
79
79
|
}
|
|
@@ -27,7 +27,7 @@ export default class B3dmConverter {
|
|
|
27
27
|
i3sAttributesData: I3SAttributesData,
|
|
28
28
|
featureAttributes: any = null
|
|
29
29
|
): Promise<ArrayBuffer> {
|
|
30
|
-
const gltf = await this.buildGltf(i3sAttributesData);
|
|
30
|
+
const gltf = await this.buildGltf(i3sAttributesData, featureAttributes);
|
|
31
31
|
const b3dm = encodeSync(
|
|
32
32
|
{
|
|
33
33
|
gltfEncoded: new Uint8Array(gltf),
|
|
@@ -45,7 +45,10 @@ export default class B3dmConverter {
|
|
|
45
45
|
* @param i3sTile - Tile3D instance for I3S node
|
|
46
46
|
* @returns - encoded glb content
|
|
47
47
|
*/
|
|
48
|
-
async buildGltf(
|
|
48
|
+
async buildGltf(
|
|
49
|
+
i3sAttributesData: I3SAttributesData,
|
|
50
|
+
featureAttributes: any
|
|
51
|
+
): Promise<ArrayBuffer> {
|
|
49
52
|
const {tileContent, textureFormat} = i3sAttributesData;
|
|
50
53
|
const {
|
|
51
54
|
material,
|
|
@@ -77,6 +80,7 @@ export default class B3dmConverter {
|
|
|
77
80
|
cartographicOrigin,
|
|
78
81
|
modelMatrix
|
|
79
82
|
);
|
|
83
|
+
this._createBatchIds(tileContent, featureAttributes);
|
|
80
84
|
if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
|
|
81
85
|
delete attributes.normals;
|
|
82
86
|
}
|
|
@@ -163,25 +167,28 @@ export default class B3dmConverter {
|
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param {
|
|
168
|
-
* @returns {
|
|
170
|
+
* Create _BATCHID attribute
|
|
171
|
+
* @param {Object} i3sContent - the source object
|
|
172
|
+
* @returns {void}
|
|
169
173
|
*/
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
for (let index = 0; index < faceRanges.length / 2; index++) {
|
|
177
|
-
const fromIndex = faceRanges[rangeIndex] * 3;
|
|
178
|
-
const untilPosition = (faceRanges[rangeIndex + 1] + 1) * 3;
|
|
174
|
+
_createBatchIds(i3sContent, featureAttributes) {
|
|
175
|
+
const {featureIds} = i3sContent;
|
|
176
|
+
const {OBJECTID: objectIds} = featureAttributes || {};
|
|
177
|
+
if (!featureIds || !objectIds) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
for (let i = 0; i < featureIds.length; i++) {
|
|
182
|
+
const featureId = featureIds[i];
|
|
183
|
+
const batchId = objectIds.indexOf(featureId);
|
|
184
|
+
featureIds[i] = batchId;
|
|
183
185
|
}
|
|
184
|
-
|
|
186
|
+
|
|
187
|
+
i3sContent.attributes._BATCHID = {
|
|
188
|
+
size: 1,
|
|
189
|
+
byteOffset: 0,
|
|
190
|
+
value: featureIds
|
|
191
|
+
};
|
|
185
192
|
}
|
|
186
193
|
|
|
187
194
|
/**
|
|
@@ -3,4 +3,4 @@ import B3dmConverter from '../3d-tiles-converter/helpers/b3dm-converter';
|
|
|
3
3
|
|
|
4
4
|
const b3dmConverter = new B3dmConverter();
|
|
5
5
|
|
|
6
|
-
createWorker(async (data, options = {}) => b3dmConverter.convert(data, options.
|
|
6
|
+
createWorker(async (data, options = {}) => b3dmConverter.convert(data, options.featureAttributes));
|