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

Conversation

tfili
Copy link
Contributor

@tfili tfili commented Jul 11, 2017

Fixed issue where a composite tile containing and instanced tile that required padding would have a bad URL because the padding would end up appended to the url. There is probably a better way to handle this at the spec level.

CC @lilleyse

… required padding would have a bad URL because the padding would end up appended to the url.

// 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?

@tfili
Copy link
Contributor Author

tfili commented Jul 11, 2017

Tests and tweaks to regex should be done @mramato

@mramato
Copy link
Contributor

mramato commented Jul 11, 2017

Thanks, @lilleyse please review the new tests and merge if you're happy. Thanks.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jul 11, 2017

Update CHANGES.md please.

@lilleyse
Copy link
Contributor

Should the test use cmpt tiles instead of i3dm? Also sorry to add extra work for this, but the other tilesets in the specs folder are created in the samples-generator project and it would be good to create a new one there.

@tfili
Copy link
Contributor Author

tfili commented Jul 12, 2017

It probably won't be till next week when I can get a chance to regenerate the sample using samples-generator.

@tfili
Copy link
Contributor Author

tfili commented Jul 19, 2017

@lilleyse Added sample to samples-generator (CesiumGS/3d-tiles-validator#111). Should be good to go now.

@lilleyse
Copy link
Contributor

Updated the files from CesiumGS/3d-tiles-validator#111.

All else looks good.

@lilleyse lilleyse merged commit 796b114 into master Jul 20, 2017
@lilleyse lilleyse deleted the instanced-tile-padding branch July 20, 2017 15:04
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

Successfully merging this pull request may close these issues.

4 participants