-
Notifications
You must be signed in to change notification settings - Fork 156
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
Conversation
@likangning93 can you please review this? |
tools/lib/extractB3dm.js
Outdated
if (byteOffset % 4 === 0) { | ||
return buffer; | ||
} | ||
return Buffer.from(buffer); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
tools/lib/optimizeGlb.js
Outdated
for (var semantic in attributes) { | ||
if (attributes.hasOwnProperty(semantic)) { | ||
if (semantic === 'BATCHID') { |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Addressed your comments @likangning93. I also added support for upgrading cmpt tiles in 2b787f4 and in the process took code from #4. |
There was a problem hiding this 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!
Review after #84
This upgrades older tilesets to the latest 3D Tiles version. I've been testing this on the NYC CityGML tileset.
asset.version
to 1.0ADD
andREPLACE
_BATCHID
semantic instead ofBATCHID
in the glTFTodo: