-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 - Load tiles without extensions #5206
Conversation
bae388f
to
35cf381
Compare
35cf381
to
2c78cc9
Compare
Updated with tests. @austinEng can you double-check the traversal changes? |
@lilleyse Traversal looks good to me |
@pmconne this may be of interest for your dynamic tileset generation. |
Should this be something like a |
Are there any optimizations or functionality that we are foregoing by not knowing the tile type until the buffer is downloaded? I do not think so and we could always add a type property to the JSON in a later version, but we could roadmap this now if something worthwhile would be possible. |
Source/Scene/Cesium3DTile.js
Outdated
* </p> | ||
* | ||
* @type {Boolean} | ||
* @readonly | ||
* | ||
* @see Batched3DModel3DTileContent |
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.
Are these really needed?
content = contentFactory(that._tileset, that, that._contentUrl, arrayBuffer, 0); | ||
that.hasRenderableContent = true; | ||
} else { | ||
// The content may be json instead |
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.
In the case when the tileset is JSON, do you know if the overhead here is high? Perhaps not since new Uint8Array
should be basically free? It's important that we do not create high overhead for tilesets of tilesets since I expect many users will use this feature for large tilesets.
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.
The main overhead is trying to get the magic first, which should be pretty small. The alternative is to try to parse as content as JSON first, which would have worse overhead for the b3dm, etc tiles.
Just those comments. Did you test this with some of the large tilesets in addition to the Sandcastle examples? |
Right now there's little impact. The only area that has changed is the selection heuristic will return for renderable/tileset content, while before it was only for renderable content. |
If they were enums I would probably still make getters for better readability, would that be too much? |
I tested on a few large tilesets, I'll test on more tomorrow. |
Whatever you think. Let me know when this is ready. |
Another thing I remembered is that Tested on more tilesets, no issues. |
Can you also please update the spec to say that the extension is not required? Runtimes should look at the |
Looks good! |
@lilleyse I can't delete the |
The loader no longer cares about the tile extensions but instead looks at the magic of the content buffer. If the magic is not a valid type, it tries to parse it as JSON. So a tile content url of
tileset/1/0
can refer to a b3dm, i3dm, pnts, or external tileset.This requires a few structural changes:
Cesium3DTileContent
related files:request
andinitialize
function. Requests are generic now and handled inCesium3DTile
. The constructor takes an array buffer and byte offset. Resources likemodel
,modelInstanceCollection
etc are created immediately (but not ready initially).state
. This is now stored inCesium3DTile
. However they still have areadyPromise
.contentReadyToProcessPromise
is removed here, but added toCesium3DTile
.Cesium3DTile
:contentReadyToProcessPromise
,contentReadyPromise
, andcontentState
.undefined
until the request happens, so they are alwaysundefined
for empty tiles. This will be helpful for the tile expiration approach I was going with.content
is undefined until the tile is loaded.hasRenderableContent
- previouslyhasContent
hasTilesetContent
hasEmptyContent
- newly addedhasRenderableContent
andhasTilesetContent
arefalse
until the content is loaded.Cesium3DTileset
loadTileset
no longer makes the request and then parses the JSON, just parses the JSON. Otherwise it is mostly unchanged, just indented differently.To-do:
loadWithXHR
]Tileset3DTileContent
takes an array buffer and converts to JSON. This could be inefficient if we already know the url ends with.json
and let the browser do the work instead.hasRenderableContent
andhasTilesetContent
can be set right away if the extension exists.