Simplification of the loading process for rasterized tiles and mesh tiles #2609
Simplification of the loading process for rasterized tiles and mesh tiles #2609gchoqueux wants to merge 4 commits into
Conversation
489581c to
afdfc01
Compare
|
Rebased |
|
I’ve come up with a possible way to simplify this — what do you think of these changes? |
afdfc01 to
6f64fdf
Compare
2cec783 to
15dfa04
Compare
|
c7b4635 to
4bd5c32
Compare
|
|
e9aab85 to
3d3be67
Compare
eecc503 to
4c86123
Compare
5235375 to
7a3ea9a
Compare
|
Hi! I'm starting to look into the loading processes to get familiar with them, in order to improve them after this simplification is completed. Thanks for the work done so far! |
7a07fe7 to
47507b0
Compare
Remaining work in this PR
FAQ
I don't remember exactly i remove the commentary
I think it's not a bug
|
Next steps to move forward on the PR
Assistance can be provided on the following points:
|
47507b0 to
5b6ea96
Compare
92e8c4c to
a9618c4
Compare
a9618c4 to
c581383
Compare
Desplandis
left a comment
There was a problem hiding this comment.
The proposed changes are fine by me. It makes the code more easy to understand (e.g. no need to track the changes of layerUpdateState across 4 different files). I did some high-level comments on the code (and some low-level too sorry), those are some questions about the behaviour before and after this PR.
Note that I did not tested it across our examples, nor did I run the tests.
Could you please provide a list of the remaining things to address in this PR?
| // [TEMP] find best place to update uniforms | ||
| node.material.layersNeedUpdate = node.material.visible; |
There was a problem hiding this comment.
This is similar to the old behaviour, but I agree that we should reconsider where we should request a new update of the material!
There was a problem hiding this comment.
yes, it's not the best place, because node.material.layersNeedUpdate is true each time that tileMesh is visible
| anyVisibleData(node) { | ||
| const current = node.material.getElevationTile()?.layer; | ||
| return super.anyVisibleData(node) | ||
| && (current?.source == this.source || this.source.zoom.min > (current?.source.zoom.max || -1)); |
There was a problem hiding this comment.
What is the meaning of -1 here?
There was a problem hiding this comment.
it's for this.source.zoom.min > -1 would be always true
There was a problem hiding this comment.
In that case, the data is considered visible if source.zoom.min < layer.source.zoom.max? Not sure to follow here.
There was a problem hiding this comment.
I clarified this by refactoring the code
|
@gchoqueux Are you available for a session of peer programming on this PR tomorrow or the following monday? I would like to converge on this one. =) |
|
I'm currently looking to the PR (hope we can finalise this), catched a regression on P.S.: |
| return layer; | ||
| } | ||
| itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig); | ||
| const p = itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig); |
There was a problem hiding this comment.
I think a top-level await would be clearer. This comment applies to all examples of itowns per-se.
| if (this.shouldWriteTextureAtIndex(index, texture)) { | ||
| this.level = (texture && texture.extent) ? texture.extent.zoom : this.level; | ||
| this.textures[index] = texture || null; | ||
| if (texture && this.shouldWriteTextureAtIndex(index, texture)) { |
There was a problem hiding this comment.
Is there some places where we could pass an undefined texture there? Shall those undefined be filtered before at the call sites?
There was a problem hiding this comment.
If we filter out undefined textures, we lose the indexing needed to assign them
| function refinementCommandCancellationFn(cmd) { | ||
| const { requester, view } = cmd; | ||
| const child = requester.children[0]; | ||
|
|
||
| // to do remove useless | ||
| return !cmd.force && (!view || !requester.parent || !requester.material || !requester.material.visible || child?.visible); | ||
| } |
| colorlayers.sort((a, b) => | ||
| this.colorTileIds.indexOf(a.id) - this.colorTileIds.indexOf(b.id), | ||
| ); | ||
| if (this.layersNeedUpdate) { |
There was a problem hiding this comment.
Prefer an early return with the !this.layersNeedUpdate condition.
|
|
||
| node.material.visible = true; | ||
| node.material.layersNeedUpdate = true; | ||
| if (node.visible && this.subdivision(context, node)) { |
There was a problem hiding this comment.
There are some issues with the freshly subdivided tiles which have no terrain and no imagery (e.g. view_25dmap and misc_clamp_ground issues are flagrant). Re-adding the hasEnoughTexturesToSubvide condition seems to fix the problem, however I think the problem is more profound.
There was a problem hiding this comment.
may be add hasEnoughTexturesToSubvide for the first tile ?
There was a problem hiding this comment.
and refactor hasEnoughTexturesToSubvide to LayeredMaterial
There was a problem hiding this comment.
I add a new wip commit :
5a42809 fix(TiledGeometryLayer): [WIP][PROPOSAL] avoid to subdivide node mesh if raster tiles aren't loaded
|
Looking at it, I think the problem is two-fold:
|
BREACKING CHANGES: remove pdateLayeredMaterialNodeImagery, updateLayeredMaterialNodeElevation
… if raster tiles aren't loaded
Description
This PR proposes a possible simplification of the loading process for rasterized tiles and mesh tiles.
Summary of changes
TileMeshinstances are now created directly inTiledGeometryLayer, without using commands or providers.TileMesh.pendingSubdivisionhas been removed.TiledGeometryLayer#hasEnoughTexturesToSubdividehas been removed.updateLayeredMaterialNodeImageryandupdateLayeredMaterialNodeElevationhave been merged into a single lightweight method.TileProviderhas been deleted.RasterTile#load.