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

3d Tiles composite padding breaks instanced tiles #5612

Merged
merged 8 commits into from
Jul 20, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/Scene/Instanced3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ define([

if (gltfFormat === 0) {
var gltfUrl = getStringFromTypedArray(gltfView);

// We need to remove padding from the end of the model URL in case this tile was part of a composite tile
// This removes all white space and null characters from the end of the string.
gltfUrl = gltfUrl.trim().replace(/\0+$/, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this just be gltfUrl.replace(/\s+$/, ''); Why the need for trim or null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And shouldn't we add a unit test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because trim and \s only match whitespace characters which according to the docs are:

A space character
A tab character
A carriage return character
A new line character
A vertical tab character
A form feed character

null would be a common pad character as well as a lot of languages initialize buffers to 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but if there's whitespace followed by null followed by more whitespace, this will fail right? Should you get rid of trim and have a regex that removes all null and whitespace at the end?

collectionOptions.url = getAbsoluteUri(joinUrls(getBaseUri(content._url, true), gltfUrl));
} else {
collectionOptions.gltf = gltfView;
Expand Down