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

Upgrade tileset stage #86

Merged
merged 6 commits into from
Jul 4, 2017
Merged

Upgrade tileset stage #86

merged 6 commits into from
Jul 4, 2017

Conversation

lilleyse
Copy link
Contributor

Review after #84

This upgrades older tilesets to the latest 3D Tiles version. I've been testing this on the NYC CityGML tileset.

  • Sets asset.version to 1.0
  • Uses uppercase ADD and REPLACE
  • Uses _BATCHID semantic instead of BATCHID in the glTF
  • Upgrades b3dm tiles that use the deprecated headers

Todo:

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 28, 2017

@likangning93 can you please review this?

if (byteOffset % 4 === 0) {
return buffer;
}
return Buffer.from(buffer);
Copy link
Contributor

Choose a reason for hiding this comment

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

From what I can tell, this is just copying buffer in memory if byteOffset isn't aligned to 4 bytes. Is this so the b3dm buffer can be modified somewhere without damaging the glb? It might be worth documenting.

return new Promise(function (resolve, reject) {
var readStream = fsExtra.createReadStream(file, readStreamOptions);
readStream.on('error', reject);
readStream.on('data', function(chunk) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just checking the first chunk right? Should this be readStream.once('data' //...? Also, I'm still not 100% with streams, but should this get manually closed after the first chunk is read?

for (var semantic in attributes) {
if (attributes.hasOwnProperty(semantic)) {
if (semantic === 'BATCHID') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a bad idea to directly look up attributes.BATCHID? If not, it might be a little cleaner.

if (parameters.hasOwnProperty(parameterId)) {
var parameter = parameters[parameterId];
if (parameter.semantic === 'BATCHID') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this case is different.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah right...

afterEach(function (done) {
Promise.all([
fsExtra.remove(upgradedDirectory),
fsExtra.remove(gzippedDirectory)
Copy link
Contributor

Choose a reason for hiding this comment

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

since upgradeTileset takes a write callback, should we try to avoid filesystem changing operations in this spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this needs to be fixed throughout the codebase. I'll write an issue.

@lilleyse lilleyse mentioned this pull request Jul 2, 2017
@lilleyse
Copy link
Contributor Author

lilleyse commented Jul 2, 2017

Addressed your comments @likangning93.

I also added support for upgrading cmpt tiles in 2b787f4 and in the process took code from #4.

Copy link
Contributor

@likangning93 likangning93 left a comment

Choose a reason for hiding this comment

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

New changes look good, thanks @lilleyse!

@likangning93 likangning93 merged commit 0b904e2 into master Jul 4, 2017
@likangning93 likangning93 deleted the upgrade-tileset branch July 4, 2017 19:06
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.

3 participants