@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
|
@@ -17,7 +17,7 @@ export default class B3dmConverter {
|
|
|
17
17
|
* @param i3sTile - Tile3D instance for I3S node
|
|
18
18
|
* @returns - encoded glb content
|
|
19
19
|
*/
|
|
20
|
-
buildGltf(i3sAttributesData: I3SAttributesData): Promise<ArrayBuffer>;
|
|
20
|
+
buildGltf(i3sAttributesData: I3SAttributesData, featureAttributes: any): Promise<ArrayBuffer>;
|
|
21
21
|
/**
|
|
22
22
|
* Update gltfBuilder with texture from I3S tile
|
|
23
23
|
* @param {object} i3sTile - Tile3D object
|
|
@@ -44,11 +44,11 @@ export default class B3dmConverter {
|
|
|
44
44
|
*/
|
|
45
45
|
_generateTransformMatrix(cartesianOrigin: any): Matrix4;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @param {
|
|
49
|
-
* @returns {
|
|
47
|
+
* Create _BATCHID attribute
|
|
48
|
+
* @param {Object} i3sContent - the source object
|
|
49
|
+
* @returns {void}
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
_createBatchIds(i3sContent: any, featureAttributes: any): void;
|
|
52
52
|
/**
|
|
53
53
|
* luma.gl can not work without indices now:
|
|
54
54
|
* https://github.com/visgl/luma.gl/blob/d8cad75b9f8ca3e578cf078ed9d19e619c2ddbc9/modules/experimental/src/gltf/gltf-instantiator.js#L115
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b3dm-converter.d.ts","sourceRoot":"","sources":["../../../src/3d-tiles-converter/helpers/b3dm-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AAKxE,OAAO,EAAC,OAAO,EAAU,MAAM,eAAe,CAAC;AAO/C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAEhC,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,GAAG,CAAC;IAEb;;;;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+ChD,kBAAkB,CAAC,UAAU,KAAA;IAY7B,aAAa,CAAC,OAAO,KAAA;CAItB"}
|
|
@@ -18,7 +18,7 @@ class B3dmConverter {
|
|
|
18
18
|
* @returns - encoded content
|
|
19
19
|
*/
|
|
20
20
|
async convert(i3sAttributesData, featureAttributes = null) {
|
|
21
|
-
const gltf = await this.buildGltf(i3sAttributesData);
|
|
21
|
+
const gltf = await this.buildGltf(i3sAttributesData, featureAttributes);
|
|
22
22
|
const b3dm = (0, core_1.encodeSync)({
|
|
23
23
|
gltfEncoded: new Uint8Array(gltf),
|
|
24
24
|
type: 'b3dm',
|
|
@@ -32,7 +32,7 @@ class B3dmConverter {
|
|
|
32
32
|
* @param i3sTile - Tile3D instance for I3S node
|
|
33
33
|
* @returns - encoded glb content
|
|
34
34
|
*/
|
|
35
|
-
async buildGltf(i3sAttributesData) {
|
|
35
|
+
async buildGltf(i3sAttributesData, featureAttributes) {
|
|
36
36
|
const { tileContent, textureFormat } = i3sAttributesData;
|
|
37
37
|
const { material, attributes, indices: originalIndices, cartesianOrigin, cartographicOrigin, modelMatrix } = tileContent;
|
|
38
38
|
const gltfBuilder = new gltf_1.GLTFScenegraph();
|
|
@@ -45,6 +45,7 @@ class B3dmConverter {
|
|
|
45
45
|
attributes.texCoords.value = (0, texture_atlas_1.convertTextureAtlas)(attributes.texCoords.value, attributes.uvRegions.value);
|
|
46
46
|
}
|
|
47
47
|
attributes.positions.value = this._normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix);
|
|
48
|
+
this._createBatchIds(tileContent, featureAttributes);
|
|
48
49
|
if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
|
|
49
50
|
delete attributes.normals;
|
|
50
51
|
}
|
|
@@ -123,23 +124,26 @@ class B3dmConverter {
|
|
|
123
124
|
return result;
|
|
124
125
|
}
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
127
|
-
* @param {
|
|
128
|
-
* @returns {
|
|
127
|
+
* Create _BATCHID attribute
|
|
128
|
+
* @param {Object} i3sContent - the source object
|
|
129
|
+
* @returns {void}
|
|
129
130
|
*/
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
batchId.
|
|
139
|
-
|
|
140
|
-
currentBatchId += 1;
|
|
131
|
+
_createBatchIds(i3sContent, featureAttributes) {
|
|
132
|
+
const { featureIds } = i3sContent;
|
|
133
|
+
const { OBJECTID: objectIds } = featureAttributes || {};
|
|
134
|
+
if (!featureIds || !objectIds) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
for (let i = 0; i < featureIds.length; i++) {
|
|
138
|
+
const featureId = featureIds[i];
|
|
139
|
+
const batchId = objectIds.indexOf(featureId);
|
|
140
|
+
featureIds[i] = batchId;
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
i3sContent.attributes._BATCHID = {
|
|
143
|
+
size: 1,
|
|
144
|
+
byteOffset: 0,
|
|
145
|
+
value: featureIds
|
|
146
|
+
};
|
|
143
147
|
}
|
|
144
148
|
/**
|
|
145
149
|
* luma.gl can not work without indices now:
|