feat(implicitTiling): Add support for external buffer#1038
feat(implicitTiling): Add support for external buffer#1038gkjohnson merged 6 commits intoNASA-AMMOS:masterfrom
Conversation
e43093c to
a26bc65
Compare
|
This seems like a big improvement, the frequency of errors went way down in my testing - but I was still able to trigger the same error in every map I tested, it just took a lot more navigation and more aggressive refinement before it triggered. Same issue as #1032, the parser is trying to fetch subtree files that don't exist. If it's helpful, here are two examples: subtrees.zip From the tileset provided in the #1032: |
The Plugin.parseTile function is asynchronous so we can |
|
@gkjohnson @jsulli Thank you both for your feedback. I'll edit this PR, to add the support of external buffer instead of ignoring it. @jsulli I still can't try with your data right now, so it could be nice if you could test it yourself once I've made the necessary changes (I'll ping you), thank you 👍 |
The bin reference is specified in a json chunk in the .subtree file. See the section in the spec here: {
"buffers": [
{
"byteLength": 586
},
{
"uri": "0_1.bin",
"byteLength": 4096
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 586
},
{
"buffer": 1,
"byteOffset": 0,
"byteLength": 4096
}
],
"tileAvailability": {
"bitstream": 0,
"availableCount": 157
},
"contentAvailability": [
{
"bitstream": 0,
"availableCount": 157
}
],
"childSubtreeAvailability": {
"bitstream": 1,
"availableCount": 429
}
} |
|
@gkjohnson Oh I got confused with the architecture for the folders. Ok, I got it now, thanks 👍 |
02920d4 to
b23d421
Compare
|
@jsulli could you try this updated version please ? It should load the .bin and display it |
|
Edit: Disregard, some |
|
@AnthonyGlt tested against 5 octree tiling scheme datasets, I could not repeat the error from #1032 in any of them. Seems to be fixed to me! |
| promises.push( | ||
| fetch( this.parseImplicitURIBuffer( this.tile, this.rootTile.implicitTiling.subtrees.uri, bufferHeader.uri ) ) | ||
| .then( response => { | ||
|
|
||
| if ( ! response.ok ) { | ||
|
|
||
| throw new Error( `Failed to load external buffer from ${bufferHeader.uri}` ); | ||
|
|
||
| } | ||
| return response.arrayBuffer(); | ||
|
|
||
| } ) | ||
| .then( arrayBuffer => { | ||
|
|
||
| return new Uint8Array( arrayBuffer ); | ||
|
|
||
| } ) | ||
| ); |
There was a problem hiding this comment.
Can we separate this out into a few lines for readability. Ie a url, fetch promise, and then push the promise onto the array.
|
|
||
| if ( ! response.ok ) { | ||
|
|
||
| throw new Error( `Failed to load external buffer from ${bufferHeader.uri}` ); |
There was a problem hiding this comment.
Lets include the source of the error and the specific failure so it's more clear what's happened:
throw new Error( `SUBTREELoader: Failed to load external buffer from ${ bufferHeader.uri } with error code ${ response.status }.` );| // If the buffer is not active, resolve with undefined. | ||
| if ( ! bufferHeader.isActive ) { | ||
|
|
||
| promises.push( Promise.resolve( undefined ) ); |
There was a problem hiding this comment.
Let's remove "undefined" here - we can just call Promise.resolve().
|
@AnthonyGlt I think this looks good to me, now. Once you've taken a look at my final changes and think they're okay we can merge this. Thanks again for putting the time into it! |
|
@gkjohnson Thank you for the commits ! All good, can be merged |
|
Thanks @AnthonyGlt - do you mind making sure the remaining list of implicit tiling features from #608 (comment) is up to date and possibly linking to some example data sets for the related features if they're available? |



Fix #844
Fix #1032
SUPPORT correctly the external buffer presents in the subtree.
The support of an external buffer (.bin) is not done yet #608 (comment) .
@gkjohnson it doesn't seem that hard to implement BUT I don't really know how the manage the cache once the buffer has been uploaded.
In Cesium:
The presence of an external buffer is checked here:
https://github.com/CesiumGS/cesium/blob/466f780f3a50d6edd17b1f27e1cde5f86ce10128/packages/engine/Source/Scene/ImplicitSubtree.js#L700
And loaded here
https://github.com/CesiumGS/cesium/blob/466f780f3a50d6edd17b1f27e1cde5f86ce10128/packages/engine/Source/Scene/ImplicitSubtree.js#L719
How could we do something similar to cache the incoming buffer ?