@loaders.gl/i3s 3.1.8 → 3.2.0-alpha.1
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 +110 -58
- 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 +1 -1
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- 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 +46 -42
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/types.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 +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- 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 +33 -29
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-worker.js +140 -67
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +33 -29
- package/dist/types.d.ts +2 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/i3s-building-scene-layer-loader.ts +1 -1
- package/src/i3s-content-loader.ts +1 -1
- package/src/lib/parsers/parse-i3s-tile-content.ts +37 -32
- package/src/types.ts +2 -3
|
@@ -4,7 +4,7 @@ import {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';
|
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
6
|
|
|
7
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : '
|
|
7
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
|
|
8
8
|
/**
|
|
9
9
|
* Loader for I3S - Indexed 3D Scene Layer
|
|
10
10
|
*/
|
|
@@ -72,7 +72,10 @@ export async function parseI3STileContent(
|
|
|
72
72
|
tile.content.texture = await parse(arrayBuffer, loader, options);
|
|
73
73
|
}
|
|
74
74
|
} else if (loader === CompressedTextureLoader || loader === BasisLoader) {
|
|
75
|
-
|
|
75
|
+
let texture = await load(arrayBuffer, loader, tile.textureLoaderOptions);
|
|
76
|
+
if (loader === BasisLoader) {
|
|
77
|
+
texture = texture[0];
|
|
78
|
+
}
|
|
76
79
|
tile.content.texture = {
|
|
77
80
|
compressed: true,
|
|
78
81
|
mipmaps: false,
|
|
@@ -304,7 +307,7 @@ function normalizeAttributes(
|
|
|
304
307
|
arrayBuffer: ArrayBuffer,
|
|
305
308
|
byteOffset: number,
|
|
306
309
|
vertexAttributes: VertexAttribute | FeatureAttribute,
|
|
307
|
-
|
|
310
|
+
attributeCount: number,
|
|
308
311
|
attributesOrder: string[]
|
|
309
312
|
) {
|
|
310
313
|
const attributes: I3SMeshAttributes = {};
|
|
@@ -314,44 +317,46 @@ function normalizeAttributes(
|
|
|
314
317
|
if (vertexAttributes[attribute]) {
|
|
315
318
|
const {valueType, valuesPerElement}: {valueType: string; valuesPerElement: number} =
|
|
316
319
|
vertexAttributes[attribute];
|
|
317
|
-
// update count and byteOffset count by calculating from defaultGeometrySchema + binnary content
|
|
318
|
-
const count = vertexCount;
|
|
319
320
|
// protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.
|
|
320
321
|
// In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)
|
|
321
322
|
// In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.
|
|
322
323
|
// Code below does not account when the bytelength is actually bigger than
|
|
323
324
|
// the calculated value (b\c the tile potentially could have mesh segmentation information).
|
|
324
325
|
// In those cases tiles without regions could fail or have garbage values.
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
326
|
+
if (
|
|
327
|
+
byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=
|
|
328
|
+
arrayBuffer.byteLength
|
|
329
|
+
) {
|
|
330
|
+
const buffer = arrayBuffer.slice(byteOffset);
|
|
331
|
+
let value: TypedArray;
|
|
332
|
+
|
|
333
|
+
if (valueType === 'UInt64') {
|
|
334
|
+
value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
|
|
335
|
+
} else {
|
|
336
|
+
const TypedArrayType = getConstructorForDataFormat(valueType);
|
|
337
|
+
value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
|
|
338
|
+
}
|
|
337
339
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
340
|
+
attributes[attribute] = {
|
|
341
|
+
value,
|
|
342
|
+
type: GL_TYPE_MAP[valueType],
|
|
343
|
+
size: valuesPerElement
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
switch (attribute) {
|
|
347
|
+
case 'color':
|
|
348
|
+
attributes.color.normalized = true;
|
|
349
|
+
break;
|
|
350
|
+
case 'position':
|
|
351
|
+
case 'region':
|
|
352
|
+
case 'normal':
|
|
353
|
+
default:
|
|
354
|
+
}
|
|
353
355
|
|
|
354
|
-
|
|
356
|
+
byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
|
|
357
|
+
} else if (attribute !== 'uv0') {
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
355
360
|
}
|
|
356
361
|
}
|
|
357
362
|
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type {GLTFMaterial} from '@loaders.gl/gltf';
|
|
2
|
-
import type {
|
|
3
|
-
import type {TextureLevel} from '@loaders.gl/
|
|
4
|
-
import {Matrix4, Quaternion, Vector3} from '@math.gl/core';
|
|
2
|
+
import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';
|
|
3
|
+
import type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';
|
|
5
4
|
|
|
6
5
|
export enum DATA_TYPE {
|
|
7
6
|
UInt8 = 'UInt8',
|