Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GLTF: TypedArray for BufferView #2817

Open
Krassnig opened this issue Nov 30, 2023 · 0 comments
Open

[Bug] GLTF: TypedArray for BufferView #2817

Krassnig opened this issue Nov 30, 2023 · 0 comments

Comments

@Krassnig
Copy link

Krassnig commented Nov 30, 2023

Hi,

this tileset of the city of Poznan fails when trying to call the constructor for a UInt8Array.

image

I tried to debug the error. In @loaders.gl/gltf/src/lib/gltf-utils/get-typed-array.ts in the function getTypedArrayForBufferView() (link) the binChunk.arrayBuffer is empty but the bufferView.byteLength is some larger number.

Here is a minimal script to reproduce the error:

import { Tiles3DLoader } from "@loaders.gl/3d-tiles";
import { load } from "@loaders.gl/core";
import { Tileset3D } from "@loaders.gl/tiles";
import { WebMercatorViewport } from "@deck.gl/core/typed";

main();
async function main() {
	// tilset of Poznan
	const tilesetJson = await load('http://sip.poznan.pl/model3d/dane/94e73271-85ad-4ef5-8383-ea60a764aa25/tileset.json', Tiles3DLoader);
	const tileset3d = new Tileset3D(tilesetJson, {
		onTileLoad: tile => {
			console.log('tile loaded: ', tile.content.type, tile);
		},
		onTileError: error => {
			console.info('tile erred: ', error);
		}
	});
	
	// Poznan Town Hall
	tileset3d.selectTiles(new WebMercatorViewport({
		width: 2000,
		height: 2000,
		latitude: 52.40857470479989,
		longitude: 16.93402119865525,
		zoom: 18
	}));

	await delay(2000);

	// Arena Sports hall
	tileset3d.selectTiles(new WebMercatorViewport({
		width: 2000,
		height: 2000,
		latitude: 52.397712588813555,
		longitude: 16.891957810801795,
		zoom: 18
	}));

	await delay(2000);

	tileset3d.selectTiles(new WebMercatorViewport({
		width: 2000,
		height: 2000,
		latitude: 52.407871838998496,
		longitude: 16.917021075095796,
		zoom: 18
	}));
}

function delay(milliseconds: number) {
	return new Promise<void>(resolve => setTimeout(() => resolve(), milliseconds));
}

Sorry for opening three issues all at once 😅 and thanks for developing this library :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant