@loaders.gl/i3s 3.2.7 → 3.3.0-alpha.3
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/dist.min.js +62 -55
- package/dist/es5/arcgis-webscene-loader.js +1 -1
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +22 -9
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +36 -38
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +75 -77
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/workers/i3s-content-nodejs-worker.js +10 -0
- package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -0
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/arcgis-webscene-loader.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +14 -5
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +8 -12
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +35 -33
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/workers/i3s-content-nodejs-worker.js +5 -0
- package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -0
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +10 -5
- package/dist/i3s-content-nodejs-worker.js +200 -0
- package/dist/i3s-content-nodejs-worker.js.map +7 -0
- package/dist/i3s-content-worker.js +56 -49
- package/dist/i3s-loader.d.ts +5 -0
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +6 -9
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +35 -32
- package/dist/lib/parsers/parse-i3s.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +1 -1
- package/dist/types.d.ts +41 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/workers/i3s-content-nodejs-worker.d.ts +2 -0
- package/dist/workers/i3s-content-nodejs-worker.d.ts.map +1 -0
- package/dist/workers/i3s-content-nodejs-worker.js +6 -0
- package/package.json +11 -10
- package/src/i3s-building-scene-layer-loader.ts +1 -1
- package/src/i3s-content-loader.ts +20 -7
- package/src/i3s-loader.ts +15 -12
- package/src/lib/parsers/parse-i3s-tile-content.ts +44 -41
- package/src/lib/parsers/parse-i3s.ts +1 -1
- package/src/types.ts +45 -0
- package/src/workers/i3s-content-nodejs-worker.ts +5 -0
package/dist/es5/i3s-loader.js
CHANGED
|
@@ -21,7 +21,7 @@ var _parseI3s = require("./lib/parsers/parse-i3s");
|
|
|
21
21
|
|
|
22
22
|
var _constants = require("./lib/parsers/constants");
|
|
23
23
|
|
|
24
|
-
var VERSION = typeof "3.
|
|
24
|
+
var VERSION = typeof "3.3.0-alpha.3" !== 'undefined' ? "3.3.0-alpha.3" : 'latest';
|
|
25
25
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
26
26
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
27
27
|
var SLPK_HEX = '504b0304';
|
|
@@ -35,12 +35,13 @@ var I3SLoader = {
|
|
|
35
35
|
extensions: ['bin'],
|
|
36
36
|
options: {
|
|
37
37
|
i3s: {
|
|
38
|
-
loadContent: true,
|
|
39
38
|
token: null,
|
|
40
39
|
isTileset: 'auto',
|
|
41
40
|
isTileHeader: 'auto',
|
|
42
41
|
tile: null,
|
|
43
42
|
tileset: null,
|
|
43
|
+
_tileOptions: null,
|
|
44
|
+
_tilesetOptions: null,
|
|
44
45
|
useDracoGeometry: true,
|
|
45
46
|
useCompressedTextures: true,
|
|
46
47
|
decodeTextures: true,
|
|
@@ -50,29 +51,37 @@ var I3SLoader = {
|
|
|
50
51
|
};
|
|
51
52
|
exports.I3SLoader = I3SLoader;
|
|
52
53
|
|
|
53
|
-
function parseI3S(_x
|
|
54
|
+
function parseI3S(_x) {
|
|
54
55
|
return _parseI3S.apply(this, arguments);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
function _parseI3S() {
|
|
58
|
-
_parseI3S = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data
|
|
59
|
-
var
|
|
59
|
+
_parseI3S = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
|
|
60
|
+
var options,
|
|
61
|
+
context,
|
|
62
|
+
url,
|
|
63
|
+
magicNumber,
|
|
64
|
+
isTileset,
|
|
65
|
+
isTileHeader,
|
|
66
|
+
_args = arguments;
|
|
60
67
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
61
68
|
while (1) {
|
|
62
69
|
switch (_context.prev = _context.next) {
|
|
63
70
|
case 0:
|
|
71
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
72
|
+
context = _args.length > 2 ? _args[2] : undefined;
|
|
64
73
|
url = context.url;
|
|
65
74
|
options.i3s = options.i3s || {};
|
|
66
75
|
magicNumber = getMagicNumber(data);
|
|
67
76
|
|
|
68
77
|
if (!(magicNumber === SLPK_HEX)) {
|
|
69
|
-
_context.next =
|
|
78
|
+
_context.next = 7;
|
|
70
79
|
break;
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
throw new Error('Files with .slpk extention currently are not supported by I3SLoader');
|
|
74
83
|
|
|
75
|
-
case
|
|
84
|
+
case 7:
|
|
76
85
|
if (options.i3s.isTileset === 'auto') {
|
|
77
86
|
isTileset = TILESET_REGEX.test(url);
|
|
78
87
|
} else {
|
|
@@ -86,54 +95,43 @@ function _parseI3S() {
|
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
if (!isTileset) {
|
|
89
|
-
_context.next =
|
|
98
|
+
_context.next = 15;
|
|
90
99
|
break;
|
|
91
100
|
}
|
|
92
101
|
|
|
93
|
-
_context.next =
|
|
102
|
+
_context.next = 12;
|
|
94
103
|
return parseTileset(data, options, context);
|
|
95
104
|
|
|
96
|
-
case
|
|
105
|
+
case 12:
|
|
97
106
|
data = _context.sent;
|
|
98
|
-
_context.next =
|
|
107
|
+
_context.next = 24;
|
|
99
108
|
break;
|
|
100
109
|
|
|
101
|
-
case
|
|
110
|
+
case 15:
|
|
102
111
|
if (!isTileHeader) {
|
|
103
|
-
_context.next = 23;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
_context.next = 16;
|
|
108
|
-
return parseTile(data, options, context);
|
|
109
|
-
|
|
110
|
-
case 16:
|
|
111
|
-
data = _context.sent;
|
|
112
|
-
|
|
113
|
-
if (!options.i3s.loadContent) {
|
|
114
112
|
_context.next = 21;
|
|
115
113
|
break;
|
|
116
114
|
}
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return (0, _core.load)(data.contentUrl, I3SLoader, options);
|
|
116
|
+
_context.next = 18;
|
|
117
|
+
return parseTile(data, context);
|
|
121
118
|
|
|
122
|
-
case
|
|
123
|
-
|
|
119
|
+
case 18:
|
|
120
|
+
data = _context.sent;
|
|
121
|
+
_context.next = 24;
|
|
124
122
|
break;
|
|
125
123
|
|
|
126
|
-
case
|
|
127
|
-
_context.next =
|
|
124
|
+
case 21:
|
|
125
|
+
_context.next = 23;
|
|
128
126
|
return parseTileContent(data, options);
|
|
129
127
|
|
|
130
|
-
case
|
|
128
|
+
case 23:
|
|
131
129
|
data = _context.sent;
|
|
132
130
|
|
|
133
|
-
case
|
|
131
|
+
case 24:
|
|
134
132
|
return _context.abrupt("return", data);
|
|
135
133
|
|
|
136
|
-
case
|
|
134
|
+
case 25:
|
|
137
135
|
case "end":
|
|
138
136
|
return _context.stop();
|
|
139
137
|
}
|
|
@@ -143,7 +141,7 @@ function _parseI3S() {
|
|
|
143
141
|
return _parseI3S.apply(this, arguments);
|
|
144
142
|
}
|
|
145
143
|
|
|
146
|
-
function parseTileContent(
|
|
144
|
+
function parseTileContent(_x2, _x3) {
|
|
147
145
|
return _parseTileContent.apply(this, arguments);
|
|
148
146
|
}
|
|
149
147
|
|
|
@@ -169,7 +167,7 @@ function _parseTileContent() {
|
|
|
169
167
|
return _parseTileContent.apply(this, arguments);
|
|
170
168
|
}
|
|
171
169
|
|
|
172
|
-
function parseTileset(
|
|
170
|
+
function parseTileset(_x4, _x5, _x6) {
|
|
173
171
|
return _parseTileset.apply(this, arguments);
|
|
174
172
|
}
|
|
175
173
|
|
|
@@ -198,18 +196,18 @@ function _parseTileset() {
|
|
|
198
196
|
return _parseTileset.apply(this, arguments);
|
|
199
197
|
}
|
|
200
198
|
|
|
201
|
-
function parseTile(
|
|
199
|
+
function parseTile(_x7, _x8) {
|
|
202
200
|
return _parseTile.apply(this, arguments);
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
function _parseTile() {
|
|
206
|
-
_parseTile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(data,
|
|
204
|
+
_parseTile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(data, context) {
|
|
207
205
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
208
206
|
while (1) {
|
|
209
207
|
switch (_context4.prev = _context4.next) {
|
|
210
208
|
case 0:
|
|
211
209
|
data = JSON.parse(new TextDecoder().decode(data));
|
|
212
|
-
return _context4.abrupt("return", (0, _parseI3s.normalizeTileData)(data,
|
|
210
|
+
return _context4.abrupt("return", (0, _parseI3s.normalizeTileData)(data, context));
|
|
213
211
|
|
|
214
212
|
case 2:
|
|
215
213
|
case "end":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-loader.ts"],"names":["VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","I3SLoader","name","id","module","version","mimeTypes","parse","parseI3S","extensions","options","i3s","
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-loader.ts"],"names":["VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","I3SLoader","name","id","module","version","mimeTypes","parse","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","COORDINATE_SYSTEM","METER_OFFSETS","data","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","parseTileContent","arrayBuffer","I3SContentLoader","tilesetJson","JSON","TextDecoder","decode","loader","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"mappings":";;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AAMA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAEA,IAAMC,aAAa,GAAG,iBAAtB;AACA,IAAMC,iBAAiB,GAAG,wBAA1B;AACA,IAAMC,QAAQ,GAAG,UAAjB;A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ACsBC,IAAI,CAAC/B,KAAL,CAAW,IAAIgC,WAAJ,GAAkBC,MAAlB,CAAyBf,IAAzB,CAAX,CADtB;AAGEY,YAAAA,WAAW,CAACI,MAAZ,GAAqBxC,SAArB;AAHF;AAAA,mBAIQ,oCAAqBoC,WAArB,EAAkC3B,OAAlC,EAA2CgB,OAA3C,CAJR;;AAAA;AAAA,8CAMSW,WANT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SASeJ,S;;;;;yEAAf,kBAAyBR,IAAzB,EAA+BC,OAA/B;AAAA;AAAA;AAAA;AAAA;AACED,YAAAA,IAAI,GAAGa,IAAI,CAAC/B,KAAL,CAAW,IAAIgC,WAAJ,GAAkBC,MAAlB,CAAyBf,IAAzB,CAAX,CAAP;AADF,8CAES,iCAAkBA,IAAlB,EAAwBC,OAAxB,CAFT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAKA,SAASG,cAAT,CAAwBJ,IAAxB,EAA8B;AAC5B,MAAIA,IAAI,YAAYiB,WAApB,EAAiC;AAE/B,WAAO,iCAAI,IAAIC,UAAJ,CAAelB,IAAf,EAAqB,CAArB,EAAwB,CAAxB,CAAJ,EACJmB,GADI,CACA,UAACC,KAAD;AAAA,aAAWA,KAAK,CAACC,QAAN,CAAe,EAAf,EAAmBC,QAAnB,CAA4B,CAA5B,EAA+B,GAA/B,CAAX;AAAA,KADA,EAEJC,IAFI,CAEC,EAFD,CAAP;AAGD;;AACD,SAAO,IAAP;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\n name: 'I3S (Indexed Scene Layers)',\n id: 'i3s',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseI3S,\n extensions: ['bin'],\n options: {\n i3s: {\n token: null,\n isTileset: 'auto',\n isTileHeader: 'auto',\n tile: null,\n tileset: null,\n _tileOptions: null,\n _tilesetOptions: null,\n useDracoGeometry: true,\n useCompressedTextures: true,\n decodeTextures: true,\n coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"file":"i3s-loader.js"}
|
|
@@ -11,7 +11,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
|
|
14
|
-
var VERSION = typeof "3.
|
|
14
|
+
var VERSION = typeof "3.3.0-alpha.3" !== 'undefined' ? "3.3.0-alpha.3" : 'latest';
|
|
15
15
|
|
|
16
16
|
function parseNodePage(_x) {
|
|
17
17
|
return _parseNodePage.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-node-page-loader.ts"],"names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"mappings":";;;;;;;;;;;;;AAIA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-node-page-loader.ts"],"names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"mappings":";;;;;;;;;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;;SAEeC,a;;;;;6EAAf,iBAA6BC,IAA7B;AAAA;AAAA;AAAA;AAAA;AAAA,6CACSC,IAAI,CAACC,KAAL,CAAW,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,IAAzB,CAAX,CADT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAOO,IAAMK,iBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,eAD2C;AAEjDC,EAAAA,EAAE,EAAE,eAF6C;AAGjDC,EAAAA,MAAM,EAAE,KAHyC;AAIjDC,EAAAA,OAAO,EAAEX,OAJwC;AAKjDY,EAAAA,SAAS,EAAE,CAAC,kBAAD,CALsC;AAMjDR,EAAAA,KAAK,EAALA,KANiD;AAOjDS,EAAAA,UAAU,EAAE,CAAC,MAAD,CAPqC;AAQjDC,EAAAA,OAAO,EAAE;AARwC,CAA5C;;;SAWQV,K;;;;;qEAAf,kBAAqBF,IAArB;AAAA;AAAA;AAAA;AAAA;AACEA,YAAAA,IAAI,GAAGD,aAAa,CAACC,IAAD,CAApB;AADF,8CAESA,IAFT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"file":"i3s-node-page-loader.js"}
|
|
@@ -68,89 +68,96 @@ function parseI3STileContent(_x, _x2, _x3, _x4, _x5) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function _parseI3STileContent() {
|
|
71
|
-
_parseI3STileContent = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer,
|
|
72
|
-
var _options$i3s, url, loader, response, _arrayBuffer, _options, texture;
|
|
71
|
+
_parseI3STileContent = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, tileOptions, tilesetOptions, options, context) {
|
|
72
|
+
var content, _options$i3s, url, loader, response, _arrayBuffer, _options, texture;
|
|
73
73
|
|
|
74
74
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
75
75
|
while (1) {
|
|
76
76
|
switch (_context.prev = _context.next) {
|
|
77
77
|
case 0:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
content = {
|
|
79
|
+
attributes: {},
|
|
80
|
+
indices: null,
|
|
81
|
+
featureIds: [],
|
|
82
|
+
vertexCount: 0,
|
|
83
|
+
modelMatrix: new _core2.Matrix4(),
|
|
84
|
+
coordinateSystem: 0,
|
|
85
|
+
byteLength: 0,
|
|
86
|
+
texture: null
|
|
87
|
+
};
|
|
81
88
|
|
|
82
|
-
if (!
|
|
83
|
-
_context.next =
|
|
89
|
+
if (!tileOptions.textureUrl) {
|
|
90
|
+
_context.next = 35;
|
|
84
91
|
break;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
url = (0, _urlUtils.getUrlWithToken)(
|
|
88
|
-
loader = getLoaderForTextureFormat(
|
|
89
|
-
_context.next =
|
|
94
|
+
url = (0, _urlUtils.getUrlWithToken)(tileOptions.textureUrl, options === null || options === void 0 ? void 0 : (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
95
|
+
loader = getLoaderForTextureFormat(tileOptions.textureFormat);
|
|
96
|
+
_context.next = 6;
|
|
90
97
|
return fetch(url, options === null || options === void 0 ? void 0 : options.fetch);
|
|
91
98
|
|
|
92
|
-
case
|
|
99
|
+
case 6:
|
|
93
100
|
response = _context.sent;
|
|
94
|
-
_context.next =
|
|
101
|
+
_context.next = 9;
|
|
95
102
|
return response.arrayBuffer();
|
|
96
103
|
|
|
97
|
-
case
|
|
104
|
+
case 9:
|
|
98
105
|
_arrayBuffer = _context.sent;
|
|
99
106
|
|
|
100
107
|
if (!(options !== null && options !== void 0 && options.i3s.decodeTextures)) {
|
|
101
|
-
_context.next =
|
|
108
|
+
_context.next = 34;
|
|
102
109
|
break;
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
if (!(loader === _images.ImageLoader)) {
|
|
106
|
-
_context.next =
|
|
113
|
+
_context.next = 26;
|
|
107
114
|
break;
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
_options = _objectSpread(_objectSpread({},
|
|
117
|
+
_options = _objectSpread(_objectSpread({}, tileOptions.textureLoaderOptions), {}, {
|
|
111
118
|
image: {
|
|
112
119
|
type: 'data'
|
|
113
120
|
}
|
|
114
121
|
});
|
|
115
|
-
_context.prev =
|
|
116
|
-
_context.next =
|
|
122
|
+
_context.prev = 13;
|
|
123
|
+
_context.next = 16;
|
|
117
124
|
return context.parse(_arrayBuffer, _options);
|
|
118
125
|
|
|
119
|
-
case
|
|
120
|
-
|
|
121
|
-
_context.next =
|
|
126
|
+
case 16:
|
|
127
|
+
content.texture = _context.sent;
|
|
128
|
+
_context.next = 24;
|
|
122
129
|
break;
|
|
123
130
|
|
|
124
|
-
case
|
|
125
|
-
_context.prev =
|
|
126
|
-
_context.t0 = _context["catch"](
|
|
127
|
-
_context.next =
|
|
131
|
+
case 19:
|
|
132
|
+
_context.prev = 19;
|
|
133
|
+
_context.t0 = _context["catch"](13);
|
|
134
|
+
_context.next = 23;
|
|
128
135
|
return (0, _core.parse)(_arrayBuffer, loader, _options);
|
|
129
136
|
|
|
130
|
-
case
|
|
131
|
-
|
|
137
|
+
case 23:
|
|
138
|
+
content.texture = _context.sent;
|
|
132
139
|
|
|
133
|
-
case
|
|
134
|
-
_context.next =
|
|
140
|
+
case 24:
|
|
141
|
+
_context.next = 32;
|
|
135
142
|
break;
|
|
136
143
|
|
|
137
|
-
case
|
|
144
|
+
case 26:
|
|
138
145
|
if (!(loader === _textures.CompressedTextureLoader || loader === _textures.BasisLoader)) {
|
|
139
|
-
_context.next =
|
|
146
|
+
_context.next = 32;
|
|
140
147
|
break;
|
|
141
148
|
}
|
|
142
149
|
|
|
143
|
-
_context.next =
|
|
144
|
-
return (0, _core.load)(_arrayBuffer, loader,
|
|
150
|
+
_context.next = 29;
|
|
151
|
+
return (0, _core.load)(_arrayBuffer, loader, tileOptions.textureLoaderOptions);
|
|
145
152
|
|
|
146
|
-
case
|
|
153
|
+
case 29:
|
|
147
154
|
texture = _context.sent;
|
|
148
155
|
|
|
149
156
|
if (loader === _textures.BasisLoader) {
|
|
150
157
|
texture = texture[0];
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
|
|
160
|
+
content.texture = {
|
|
154
161
|
compressed: true,
|
|
155
162
|
mipmaps: false,
|
|
156
163
|
width: texture[0].width,
|
|
@@ -158,76 +165,67 @@ function _parseI3STileContent() {
|
|
|
158
165
|
data: texture
|
|
159
166
|
};
|
|
160
167
|
|
|
161
|
-
case
|
|
162
|
-
_context.next =
|
|
168
|
+
case 32:
|
|
169
|
+
_context.next = 35;
|
|
163
170
|
break;
|
|
164
171
|
|
|
165
|
-
case
|
|
166
|
-
|
|
172
|
+
case 34:
|
|
173
|
+
content.texture = _arrayBuffer;
|
|
167
174
|
|
|
168
|
-
case
|
|
169
|
-
|
|
175
|
+
case 35:
|
|
176
|
+
content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
|
|
170
177
|
|
|
171
|
-
if (
|
|
172
|
-
|
|
178
|
+
if (content.material) {
|
|
179
|
+
content.texture = null;
|
|
173
180
|
}
|
|
174
181
|
|
|
175
|
-
_context.next =
|
|
176
|
-
return parseI3SNodeGeometry(arrayBuffer,
|
|
182
|
+
_context.next = 39;
|
|
183
|
+
return parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
|
|
177
184
|
|
|
178
|
-
case
|
|
185
|
+
case 39:
|
|
179
186
|
return _context.abrupt("return", _context.sent);
|
|
180
187
|
|
|
181
|
-
case
|
|
188
|
+
case 40:
|
|
182
189
|
case "end":
|
|
183
190
|
return _context.stop();
|
|
184
191
|
}
|
|
185
192
|
}
|
|
186
|
-
}, _callee, null, [[
|
|
193
|
+
}, _callee, null, [[13, 19]]);
|
|
187
194
|
}));
|
|
188
195
|
return _parseI3STileContent.apply(this, arguments);
|
|
189
196
|
}
|
|
190
197
|
|
|
191
|
-
function parseI3SNodeGeometry(_x6, _x7, _x8, _x9) {
|
|
198
|
+
function parseI3SNodeGeometry(_x6, _x7, _x8, _x9, _x10) {
|
|
192
199
|
return _parseI3SNodeGeometry.apply(this, arguments);
|
|
193
200
|
}
|
|
194
201
|
|
|
195
202
|
function _parseI3SNodeGeometry() {
|
|
196
|
-
_parseI3SNodeGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(arrayBuffer,
|
|
203
|
+
_parseI3SNodeGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(arrayBuffer, content, tileOptions, tilesetOptions, options) {
|
|
197
204
|
var _options$i3s2;
|
|
198
205
|
|
|
199
|
-
var
|
|
206
|
+
var contentByteLength, attributes, vertexCount, byteOffset, featureCount, indices, _decompressedGeometry, decompressedGeometry, _decompressedGeometry2, POSITION, NORMAL, COLOR_0, TEXCOORD_0, featureIndex, uvRegion, featureIds, _tilesetOptions$store, vertexAttributes, attributesOrder, featureAttributes, featureAttributeOrder, headers, _normalizeAttributes, normalizedVertexAttributes, offset, _normalizeAttributes2, normalizedFeatureAttributes, enuMatrix, attributeIndex;
|
|
200
207
|
|
|
201
208
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
202
209
|
while (1) {
|
|
203
210
|
switch (_context2.prev = _context2.next) {
|
|
204
211
|
case 0:
|
|
205
|
-
if (tile.content) {
|
|
206
|
-
_context2.next = 2;
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return _context2.abrupt("return", tile);
|
|
211
|
-
|
|
212
|
-
case 2:
|
|
213
|
-
content = tile.content;
|
|
214
212
|
contentByteLength = arrayBuffer.byteLength;
|
|
215
213
|
byteOffset = 0;
|
|
216
214
|
featureCount = 0;
|
|
217
215
|
|
|
218
|
-
if (!
|
|
219
|
-
_context2.next =
|
|
216
|
+
if (!tileOptions.isDracoGeometry) {
|
|
217
|
+
_context2.next = 16;
|
|
220
218
|
break;
|
|
221
219
|
}
|
|
222
220
|
|
|
223
|
-
_context2.next =
|
|
221
|
+
_context2.next = 6;
|
|
224
222
|
return (0, _core.parse)(arrayBuffer, _draco.DracoLoader, {
|
|
225
223
|
draco: {
|
|
226
224
|
attributeNameEntry: I3S_ATTRIBUTE_TYPE
|
|
227
225
|
}
|
|
228
226
|
});
|
|
229
227
|
|
|
230
|
-
case
|
|
228
|
+
case 6:
|
|
231
229
|
decompressedGeometry = _context2.sent;
|
|
232
230
|
vertexCount = decompressedGeometry.header.vertexCount;
|
|
233
231
|
indices = (_decompressedGeometry = decompressedGeometry.indices) === null || _decompressedGeometry === void 0 ? void 0 : _decompressedGeometry.value;
|
|
@@ -247,12 +245,12 @@ function _parseI3SNodeGeometry() {
|
|
|
247
245
|
flattenFeatureIdsByFeatureIndices(attributes, featureIds);
|
|
248
246
|
}
|
|
249
247
|
|
|
250
|
-
_context2.next =
|
|
248
|
+
_context2.next = 25;
|
|
251
249
|
break;
|
|
252
250
|
|
|
253
|
-
case
|
|
254
|
-
|
|
255
|
-
headers = parseHeaders(
|
|
251
|
+
case 16:
|
|
252
|
+
_tilesetOptions$store = tilesetOptions.store.defaultGeometrySchema, vertexAttributes = _tilesetOptions$store.vertexAttributes, attributesOrder = _tilesetOptions$store.ordering, featureAttributes = _tilesetOptions$store.featureAttributes, featureAttributeOrder = _tilesetOptions$store.featureAttributeOrder;
|
|
253
|
+
headers = parseHeaders(arrayBuffer, tilesetOptions);
|
|
256
254
|
byteOffset = headers.byteOffset;
|
|
257
255
|
vertexCount = headers.vertexCount;
|
|
258
256
|
featureCount = headers.featureCount;
|
|
@@ -261,9 +259,9 @@ function _parseI3SNodeGeometry() {
|
|
|
261
259
|
flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
|
|
262
260
|
attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
|
|
263
261
|
|
|
264
|
-
case
|
|
262
|
+
case 25:
|
|
265
263
|
if (!(options !== null && options !== void 0 && (_options$i3s2 = options.i3s) !== null && _options$i3s2 !== void 0 && _options$i3s2.coordinateSystem) || options.i3s.coordinateSystem === _constants.COORDINATE_SYSTEM.METER_OFFSETS) {
|
|
266
|
-
enuMatrix = parsePositions(attributes.position,
|
|
264
|
+
enuMatrix = parsePositions(attributes.position, tileOptions);
|
|
267
265
|
content.modelMatrix = enuMatrix.invert();
|
|
268
266
|
content.coordinateSystem = _constants.COORDINATE_SYSTEM.METER_OFFSETS;
|
|
269
267
|
} else {
|
|
@@ -281,7 +279,7 @@ function _parseI3SNodeGeometry() {
|
|
|
281
279
|
content.indices = indices || null;
|
|
282
280
|
|
|
283
281
|
if (attributes.id && attributes.id.value) {
|
|
284
|
-
|
|
282
|
+
content.featureIds = attributes.id.value;
|
|
285
283
|
}
|
|
286
284
|
|
|
287
285
|
for (attributeIndex in content.attributes) {
|
|
@@ -292,9 +290,9 @@ function _parseI3SNodeGeometry() {
|
|
|
292
290
|
|
|
293
291
|
content.vertexCount = vertexCount;
|
|
294
292
|
content.byteLength = contentByteLength;
|
|
295
|
-
return _context2.abrupt("return",
|
|
293
|
+
return _context2.abrupt("return", content);
|
|
296
294
|
|
|
297
|
-
case
|
|
295
|
+
case 33:
|
|
298
296
|
case "end":
|
|
299
297
|
return _context2.stop();
|
|
300
298
|
}
|
|
@@ -336,12 +334,12 @@ function normalizeAttribute(attribute) {
|
|
|
336
334
|
return attribute;
|
|
337
335
|
}
|
|
338
336
|
|
|
339
|
-
function parseHeaders(
|
|
337
|
+
function parseHeaders(arrayBuffer, options) {
|
|
340
338
|
var byteOffset = 0;
|
|
341
339
|
var vertexCount = 0;
|
|
342
340
|
var featureCount = 0;
|
|
343
341
|
|
|
344
|
-
var _iterator = _createForOfIteratorHelper(
|
|
342
|
+
var _iterator = _createForOfIteratorHelper(options.store.defaultGeometrySchema.header),
|
|
345
343
|
_step;
|
|
346
344
|
|
|
347
345
|
try {
|
|
@@ -456,8 +454,8 @@ function parseUint64Values(buffer, elementsCount, attributeSize) {
|
|
|
456
454
|
return new Uint32Array(values);
|
|
457
455
|
}
|
|
458
456
|
|
|
459
|
-
function parsePositions(attribute,
|
|
460
|
-
var mbs =
|
|
457
|
+
function parsePositions(attribute, options) {
|
|
458
|
+
var mbs = options.mbs;
|
|
461
459
|
var value = attribute.value;
|
|
462
460
|
var metadata = attribute.metadata;
|
|
463
461
|
var enuMatrix = new _core2.Matrix4();
|