@loaders.gl/tile-converter 4.0.0-alpha.17 → 4.0.0-alpha.18
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/bin/converter.js +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +5 -4
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +39 -37
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +3 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +4 -2
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +10 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.js +42 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +2 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +2 -0
- package/dist/converter.min.js +79 -79
- package/dist/dist.min.js +747 -3012
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +94 -81
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +6 -4
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js +63 -0
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +10 -4
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +46 -43
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +4 -3
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js +32 -0
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-server/bin/i3s-server.min.js +72 -72
- package/dist/esm/lib/utils/lod-conversion-utils.js +6 -4
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/lib/utils/lod-conversion-utils.d.ts +2 -2
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/lib/utils/lod-conversion-utils.js +4 -4
- package/dist/slpk-extractor.min.js +38 -38
- package/package.json +14 -14
- package/src/3d-tiles-converter/3d-tiles-converter.ts +60 -46
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +11 -10
- package/src/3d-tiles-converter/helpers/load-i3s.ts +51 -0
- package/src/3d-tiles-converter/helpers/texture-atlas.ts +6 -2
- package/src/lib/utils/lod-conversion-utils.ts +10 -6
package/bin/converter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AttributeStorageInfo } from '@loaders.gl/i3s';
|
|
2
|
-
import { Tileset3D } from '@loaders.gl/tiles';
|
|
1
|
+
import type { AttributeStorageInfo, I3STilesetHeader } from '@loaders.gl/i3s';
|
|
3
2
|
import { Geoid } from '@math.gl/geoid';
|
|
3
|
+
import { I3SLoaderOptions } from '@loaders.gl/i3s/src/i3s-loader';
|
|
4
4
|
/**
|
|
5
5
|
* Converter from i3s to 3d-tiles
|
|
6
6
|
*/
|
|
@@ -10,11 +10,12 @@ export default class Tiles3DConverter {
|
|
|
10
10
|
vertexCounter: number;
|
|
11
11
|
conversionStartTime: [number, number];
|
|
12
12
|
geoidHeightModel: Geoid | null;
|
|
13
|
-
sourceTileset:
|
|
14
|
-
attributeStorageInfo
|
|
13
|
+
sourceTileset: I3STilesetHeader | null;
|
|
14
|
+
attributeStorageInfo?: AttributeStorageInfo[] | null;
|
|
15
15
|
workerSource: {
|
|
16
16
|
[key: string]: string;
|
|
17
17
|
};
|
|
18
|
+
loaderOptions: I3SLoaderOptions;
|
|
18
19
|
constructor();
|
|
19
20
|
/**
|
|
20
21
|
* Convert i3s format data to 3dTiles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3d-tiles-converter.d.ts","sourceRoot":"","sources":["../../src/3d-tiles-converter/3d-tiles-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"3d-tiles-converter.d.ts","sourceRoot":"","sources":["../../src/3d-tiles-converter/3d-tiles-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAGpB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAcrC,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAIhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gBAAgB,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;IACrD,YAAY,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAM;IAC3C,aAAa,EAAE,gBAAgB,CAQ7B;;IAaF;;;;;;;;OAQG;IACU,OAAO,CAAC,OAAO,EAAE;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,GAAG,CAAC;IAqDhB;;;;;;OAMG;YACW,gBAAgB;IAyD9B;;;;;OAKG;YACW,YAAY;IAe1B;;;;;OAKG;YACW,cAAc;IA2B5B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAiB7B;;;;;OAKG;YACW,oBAAoB;IAsBlC;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IASzB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;;OAGG;YACW,iBAAiB;CAgBhC"}
|
|
@@ -8,7 +8,6 @@ const process_1 = __importDefault(require("process"));
|
|
|
8
8
|
const json_map_transform_1 = __importDefault(require("json-map-transform"));
|
|
9
9
|
const core_1 = require("@loaders.gl/core");
|
|
10
10
|
const i3s_1 = require("@loaders.gl/i3s");
|
|
11
|
-
const tiles_1 = require("@loaders.gl/tiles");
|
|
12
11
|
const pgm_loader_1 = require("../pgm-loader");
|
|
13
12
|
const i3s_obb_to_3d_tiles_obb_1 = require("./helpers/i3s-obb-to-3d-tiles-obb");
|
|
14
13
|
const lod_conversion_utils_1 = require("../lib/utils/lod-conversion-utils");
|
|
@@ -19,6 +18,7 @@ const coordinate_converter_1 = require("../i3s-converter/helpers/coordinate-conv
|
|
|
19
18
|
const worker_utils_1 = require("@loaders.gl/worker-utils");
|
|
20
19
|
const constants_1 = require("../constants");
|
|
21
20
|
const b3dm_converter_1 = __importDefault(require("./helpers/b3dm-converter"));
|
|
21
|
+
const load_i3s_1 = require("./helpers/load-i3s");
|
|
22
22
|
const I3S = 'I3S';
|
|
23
23
|
/**
|
|
24
24
|
* Converter from i3s to 3d-tiles
|
|
@@ -26,6 +26,15 @@ const I3S = 'I3S';
|
|
|
26
26
|
class Tiles3DConverter {
|
|
27
27
|
constructor() {
|
|
28
28
|
this.workerSource = {};
|
|
29
|
+
this.loaderOptions = {
|
|
30
|
+
_nodeWorkers: true,
|
|
31
|
+
reuseWorkers: true,
|
|
32
|
+
i3s: { coordinateSystem: i3s_1.COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false },
|
|
33
|
+
// We need to load local fs workers because nodejs can't load workers from the Internet
|
|
34
|
+
'i3s-content': {
|
|
35
|
+
workerUrl: './modules/i3s/dist/i3s-content-worker-node.js'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
29
38
|
this.options = {};
|
|
30
39
|
this.tilesetPath = '';
|
|
31
40
|
this.vertexCounter = 0;
|
|
@@ -55,25 +64,16 @@ class Tiles3DConverter {
|
|
|
55
64
|
console.log('Loading egm file...'); // eslint-disable-line
|
|
56
65
|
this.geoidHeightModel = await (0, core_1.load)(egmFilePath, pgm_loader_1.PGMLoader);
|
|
57
66
|
console.log('Loading egm file completed!'); // eslint-disable-line
|
|
58
|
-
|
|
59
|
-
this.sourceTileset
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
'i3s-content': {
|
|
66
|
-
workerUrl: './modules/i3s/dist/i3s-content-worker-node.js'
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
await this.sourceTileset.tilesetInitializationPromise;
|
|
71
|
-
const rootNode = this.sourceTileset.root;
|
|
72
|
-
if (!rootNode.header.obb) {
|
|
73
|
-
rootNode.header.obb = (0, coordinate_converter_1.createObbFromMbs)(rootNode.header.mbs);
|
|
67
|
+
this.sourceTileset = await (0, core_1.load)(inputUrl, i3s_1.I3SLoader, this.loaderOptions);
|
|
68
|
+
if (!this.sourceTileset) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const rootNode = this.sourceTileset?.root;
|
|
72
|
+
if (!rootNode.obb) {
|
|
73
|
+
rootNode.obb = (0, coordinate_converter_1.createObbFromMbs)(rootNode.mbs);
|
|
74
74
|
}
|
|
75
75
|
this.tilesetPath = (0, path_1.join)(`${outputPath}`, `${tilesetName}`);
|
|
76
|
-
this.attributeStorageInfo =
|
|
76
|
+
this.attributeStorageInfo = this.sourceTileset.attributeStorageInfo;
|
|
77
77
|
// Removing the tilesetPath needed to exclude erroneous files after conversion
|
|
78
78
|
try {
|
|
79
79
|
await (0, file_utils_1.removeDir)(this.tilesetPath);
|
|
@@ -83,7 +83,7 @@ class Tiles3DConverter {
|
|
|
83
83
|
}
|
|
84
84
|
const rootTile = {
|
|
85
85
|
boundingVolume: {
|
|
86
|
-
box: (0, i3s_obb_to_3d_tiles_obb_1.i3sObbTo3dTilesObb)(rootNode.
|
|
86
|
+
box: (0, i3s_obb_to_3d_tiles_obb_1.i3sObbTo3dTilesObb)(rootNode.obb, this.geoidHeightModel)
|
|
87
87
|
},
|
|
88
88
|
geometricError: (0, lod_conversion_utils_1.convertScreenThresholdToGeometricError)(rootNode),
|
|
89
89
|
children: []
|
|
@@ -105,19 +105,22 @@ class Tiles3DConverter {
|
|
|
105
105
|
*/
|
|
106
106
|
async convertChildNode(parentSourceNode, parentNode, level, childNodeInfo) {
|
|
107
107
|
const sourceChild = await this._loadChildNode(parentSourceNode, childNodeInfo);
|
|
108
|
-
parentSourceNode.children.push(sourceChild);
|
|
109
108
|
if (sourceChild.contentUrl) {
|
|
110
|
-
await this.sourceTileset.
|
|
111
|
-
|
|
109
|
+
const content = await (0, load_i3s_1.loadI3SContent)(this.sourceTileset, sourceChild, this.loaderOptions);
|
|
110
|
+
if (!content) {
|
|
111
|
+
await this._addChildren(sourceChild, parentNode, level + 1);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.vertexCounter += content?.vertexCount || 0;
|
|
112
115
|
let featureAttributes = null;
|
|
113
116
|
if (this.attributeStorageInfo) {
|
|
114
117
|
featureAttributes = await this._loadChildAttributes(sourceChild, this.attributeStorageInfo);
|
|
115
118
|
}
|
|
116
|
-
if (!sourceChild.
|
|
117
|
-
sourceChild.
|
|
119
|
+
if (!sourceChild.obb) {
|
|
120
|
+
sourceChild.obb = (0, coordinate_converter_1.createObbFromMbs)(sourceChild.mbs);
|
|
118
121
|
}
|
|
119
122
|
const boundingVolume = {
|
|
120
|
-
box: (0, i3s_obb_to_3d_tiles_obb_1.i3sObbTo3dTilesObb)(sourceChild.
|
|
123
|
+
box: (0, i3s_obb_to_3d_tiles_obb_1.i3sObbTo3dTilesObb)(sourceChild.obb, this.geoidHeightModel)
|
|
121
124
|
};
|
|
122
125
|
const child = {
|
|
123
126
|
boundingVolume,
|
|
@@ -125,8 +128,9 @@ class Tiles3DConverter {
|
|
|
125
128
|
children: []
|
|
126
129
|
};
|
|
127
130
|
const i3sAttributesData = {
|
|
128
|
-
tileContent:
|
|
129
|
-
|
|
131
|
+
tileContent: content,
|
|
132
|
+
box: boundingVolume.box,
|
|
133
|
+
textureFormat: sourceChild.textureFormat
|
|
130
134
|
};
|
|
131
135
|
const b3dmConverter = new b3dm_converter_1.default();
|
|
132
136
|
const b3dm = await b3dmConverter.convert(i3sAttributesData, featureAttributes);
|
|
@@ -136,7 +140,6 @@ class Tiles3DConverter {
|
|
|
136
140
|
};
|
|
137
141
|
await (0, file_utils_1.writeFile)(this.tilesetPath, new Uint8Array(b3dm), `${sourceChild.id}.b3dm`);
|
|
138
142
|
parentNode.children.push(child);
|
|
139
|
-
sourceChild.unloadContent();
|
|
140
143
|
await this._addChildren(sourceChild, child, level + 1);
|
|
141
144
|
}
|
|
142
145
|
else {
|
|
@@ -154,7 +157,7 @@ class Tiles3DConverter {
|
|
|
154
157
|
return;
|
|
155
158
|
}
|
|
156
159
|
const promises = [];
|
|
157
|
-
for (const childNodeInfo of parentSourceNode.
|
|
160
|
+
for (const childNodeInfo of parentSourceNode.children || []) {
|
|
158
161
|
promises.push(this.convertChildNode(parentSourceNode, parentNode, level, childNodeInfo));
|
|
159
162
|
}
|
|
160
163
|
await Promise.all(promises);
|
|
@@ -167,32 +170,31 @@ class Tiles3DConverter {
|
|
|
167
170
|
*/
|
|
168
171
|
async _loadChildNode(parentNode, childNodeInfo) {
|
|
169
172
|
let header;
|
|
170
|
-
if (this.sourceTileset
|
|
173
|
+
if (this.sourceTileset?.nodePagesTile) {
|
|
171
174
|
console.log(`Node conversion: ${childNodeInfo.id}`); // eslint-disable-line no-console,no-undef
|
|
172
|
-
header = await this.sourceTileset.
|
|
175
|
+
header = await this.sourceTileset.nodePagesTile.formTileFromNodePages(parseInt(childNodeInfo.id));
|
|
173
176
|
}
|
|
174
177
|
else {
|
|
175
|
-
const { loader } = this.sourceTileset;
|
|
176
178
|
const nodeUrl = this._relativeUrlToFullUrl(parentNode.url, childNodeInfo.href);
|
|
177
179
|
// load metadata
|
|
178
180
|
const options = {
|
|
179
181
|
i3s: {
|
|
180
|
-
...this.
|
|
182
|
+
...this.loaderOptions,
|
|
181
183
|
isTileHeader: true,
|
|
182
184
|
loadContent: false
|
|
183
185
|
}
|
|
184
186
|
};
|
|
185
187
|
console.log(`Node conversion: ${nodeUrl}`); // eslint-disable-line no-console,no-undef
|
|
186
|
-
header = await (0, core_1.load)(nodeUrl,
|
|
188
|
+
header = await (0, core_1.load)(nodeUrl, i3s_1.I3SLoader, options);
|
|
187
189
|
}
|
|
188
|
-
return
|
|
190
|
+
return header;
|
|
189
191
|
}
|
|
190
192
|
/**
|
|
191
193
|
* Make an url of a resource from its relative url having the base url
|
|
192
194
|
* @param baseUrl the base url. A resulting url will be related from this url
|
|
193
195
|
* @param relativeUrl a realtive url of a resource
|
|
194
196
|
*/
|
|
195
|
-
_relativeUrlToFullUrl(baseUrl, relativeUrl) {
|
|
197
|
+
_relativeUrlToFullUrl(baseUrl = '', relativeUrl) {
|
|
196
198
|
let resultArray = baseUrl.split('/');
|
|
197
199
|
const relativeUrlArray = relativeUrl.split('/');
|
|
198
200
|
for (const folder of relativeUrlArray) {
|
|
@@ -216,7 +218,7 @@ class Tiles3DConverter {
|
|
|
216
218
|
*/
|
|
217
219
|
async _loadChildAttributes(sourceChild, attributeStorageInfo) {
|
|
218
220
|
const promises = [];
|
|
219
|
-
const { attributeUrls } = sourceChild
|
|
221
|
+
const { attributeUrls = [] } = sourceChild;
|
|
220
222
|
for (let index = 0; index < attributeUrls.length; index++) {
|
|
221
223
|
const inputUrl = attributeUrls[index];
|
|
222
224
|
const attribute = attributeStorageInfo[index];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b3dm-converter.d.ts","sourceRoot":"","sources":["../../../src/3d-tiles-converter/helpers/b3dm-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"b3dm-converter.d.ts","sourceRoot":"","sources":["../../../src/3d-tiles-converter/helpers/b3dm-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAIpD,OAAO,EAAC,OAAO,EAAU,MAAM,eAAe,CAAC;AAQ/C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,cAAc,CAAC;IAC5B,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAEhC,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,GAAG,CAAC;IAEb;;;;OAIG;IACG,OAAO,CACX,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,GAAE,GAAU,GAC5B,OAAO,CAAC,WAAW,CAAC;IAcvB;;;;OAIG;IACG,SAAS,CACb,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,GAAG,GACrB,OAAO,CAAC,WAAW,CAAC;IAuDvB;;;;;OAKG;IACG,oBAAoB,CAAC,WAAW,KAAA,EAAE,aAAa,KAAA,EAAE,WAAW,KAAA;IAmBlE;;;;;;;OAOG;IACH,mBAAmB,CAAC,cAAc,KAAA,EAAE,eAAe,KAAA,EAAE,kBAAkB,KAAA,EAAE,WAAW,KAAA;IAepF;;;;;;;OAOG;IACH,wBAAwB,CAAC,eAAe,KAAA;IAMxC;;;;OAIG;IACH,eAAe,CAAC,UAAU,KAAA,EAAE,iBAAiB,KAAA;IAoB7C;;;;;OAKG;IACH,yBAAyB,CAAC,MAAM,KAAA;IAchC;;;;;OAKG;IACH,iCAAiC,CAAC,QAAQ,KAAA,EAAE,YAAY,KAAA;IAgCxD;;;;;OAKG;IACH,eAAe,CAAC,kBAAkB,KAAA,EAAE,YAAY,KAAA;IA+ChD,kBAAkB,CAAC,UAAU,KAAA;IAY7B,aAAa,CAAC,OAAO,KAAA;CAItB"}
|
|
@@ -34,8 +34,8 @@ class B3dmConverter {
|
|
|
34
34
|
* @returns - encoded glb content
|
|
35
35
|
*/
|
|
36
36
|
async buildGltf(i3sAttributesData, featureAttributes) {
|
|
37
|
-
const { tileContent, textureFormat } = i3sAttributesData;
|
|
38
|
-
const { material, attributes, indices: originalIndices,
|
|
37
|
+
const { tileContent, textureFormat, box } = i3sAttributesData;
|
|
38
|
+
const { material, attributes, indices: originalIndices, modelMatrix } = tileContent;
|
|
39
39
|
const gltfBuilder = new gltf_1.GLTFScenegraph();
|
|
40
40
|
const textureIndex = await this._addI3sTextureToGltf(tileContent, textureFormat, gltfBuilder);
|
|
41
41
|
const pbrMaterialInfo = this._convertI3sMaterialToGltfMaterial(material, textureIndex);
|
|
@@ -45,6 +45,8 @@ class B3dmConverter {
|
|
|
45
45
|
if (attributes.uvRegions && attributes.texCoords) {
|
|
46
46
|
attributes.texCoords.value = (0, texture_atlas_1.convertTextureAtlas)(attributes.texCoords.value, attributes.uvRegions.value);
|
|
47
47
|
}
|
|
48
|
+
const cartesianOrigin = new core_2.Vector3(box);
|
|
49
|
+
const cartographicOrigin = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new core_2.Vector3());
|
|
48
50
|
attributes.positions.value = this._normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix);
|
|
49
51
|
this._createBatchIds(tileContent, featureAttributes);
|
|
50
52
|
if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { I3STileContent, I3STileHeader, I3STilesetHeader, I3SLoaderOptions } from '@loaders.gl/i3s';
|
|
2
|
+
/**
|
|
3
|
+
* Load I3S node content
|
|
4
|
+
* @param sourceTileset - source layer JSON
|
|
5
|
+
* @param sourceTile - source I3S node metadata
|
|
6
|
+
* @param tilesetLoadOptions - load options for Tiles3DLoader
|
|
7
|
+
* @returns - 3DTiles tile content or null
|
|
8
|
+
*/
|
|
9
|
+
export declare const loadI3SContent: (sourceTileset: I3STilesetHeader | null, sourceTile: I3STileHeader, tilesetLoadOptions: I3SLoaderOptions) => Promise<I3STileContent | null>;
|
|
10
|
+
//# sourceMappingURL=load-i3s.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-i3s.d.ts","sourceRoot":"","sources":["../../../src/3d-tiles-converter/helpers/load-i3s.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAEhB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,kBACV,gBAAgB,GAAG,IAAI,cAC1B,aAAa,sBACL,gBAAgB,KACnC,QAAQ,cAAc,GAAG,IAAI,CA8B/B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadI3SContent = void 0;
|
|
4
|
+
const core_1 = require("@loaders.gl/core");
|
|
5
|
+
const i3s_1 = require("@loaders.gl/i3s");
|
|
6
|
+
/**
|
|
7
|
+
* Load I3S node content
|
|
8
|
+
* @param sourceTileset - source layer JSON
|
|
9
|
+
* @param sourceTile - source I3S node metadata
|
|
10
|
+
* @param tilesetLoadOptions - load options for Tiles3DLoader
|
|
11
|
+
* @returns - 3DTiles tile content or null
|
|
12
|
+
*/
|
|
13
|
+
const loadI3SContent = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
|
|
14
|
+
if (!sourceTileset || !sourceTile.contentUrl) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const loadOptions = {
|
|
18
|
+
...tilesetLoadOptions,
|
|
19
|
+
i3s: {
|
|
20
|
+
...tilesetLoadOptions.i3s,
|
|
21
|
+
isTileset: false,
|
|
22
|
+
isTileHeader: false,
|
|
23
|
+
_tileOptions: {
|
|
24
|
+
attributeUrls: sourceTile.attributeUrls,
|
|
25
|
+
textureUrl: sourceTile.textureUrl,
|
|
26
|
+
textureFormat: sourceTile.textureFormat,
|
|
27
|
+
textureLoaderOptions: sourceTile.textureLoaderOptions,
|
|
28
|
+
materialDefinition: sourceTile.materialDefinition,
|
|
29
|
+
isDracoGeometry: sourceTile.isDracoGeometry,
|
|
30
|
+
mbs: sourceTile.mbs
|
|
31
|
+
},
|
|
32
|
+
_tilesetOptions: {
|
|
33
|
+
store: sourceTileset.store,
|
|
34
|
+
attributeStorageInfo: sourceTileset.attributeStorageInfo,
|
|
35
|
+
fields: sourceTileset.fields
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const tileContent = await (0, core_1.load)(sourceTile.contentUrl, i3s_1.I3SLoader, loadOptions);
|
|
40
|
+
return tileContent;
|
|
41
|
+
};
|
|
42
|
+
exports.loadI3SContent = loadI3SContent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TypedArray } from '@loaders.gl/loader-utils';
|
|
1
2
|
/**
|
|
2
3
|
* Apply uvRegions to texture coordinates.
|
|
3
4
|
* Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/geometryUVRegion.cmn.md
|
|
@@ -5,5 +6,5 @@
|
|
|
5
6
|
* @param texCoords
|
|
6
7
|
* @param uvRegions
|
|
7
8
|
*/
|
|
8
|
-
export declare function convertTextureAtlas(texCoords:
|
|
9
|
+
export declare function convertTextureAtlas(texCoords: TypedArray, uvRegions: TypedArray): Float32Array;
|
|
9
10
|
//# sourceMappingURL=texture-atlas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-atlas.d.ts","sourceRoot":"","sources":["../../../src/3d-tiles-converter/helpers/texture-atlas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"texture-atlas.d.ts","sourceRoot":"","sources":["../../../src/3d-tiles-converter/helpers/texture-atlas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,YAAY,CAwB9F"}
|
|
@@ -43,6 +43,8 @@ function fract(uv) {
|
|
|
43
43
|
* @param regions
|
|
44
44
|
*/
|
|
45
45
|
function normalizeRegions(regions) {
|
|
46
|
+
// The code is for Uint16Array because it is the spec requirement
|
|
47
|
+
// https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryUVRegion.cmn.md
|
|
46
48
|
const MAX_UINT_16_VALUE = 65535;
|
|
47
49
|
const normalizedRegions = [];
|
|
48
50
|
for (let index = 0; index < regions.length; index++) {
|