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

Fix replacement refinement with empty tiles #3456

Merged
merged 10 commits into from
Jan 26, 2016
Merged

Fix replacement refinement with empty tiles #3456

merged 10 commits into from
Jan 26, 2016

Conversation

lilleyse
Copy link
Contributor

For #3241

I tried another approach at solving replacement refinement when empty tiles are involved. selectTiles is now back to its original state for the most part. The new idea is to find the descendant tiles as a pre-process in loadTileset. Then at the end of selectTiles the refining tiles check if all their descendant tiles were actually selected this frame. If not, the refining tile is selected and its descendants are deselected. So it's more of a reactive approach, which is actually safer because I noticed some edge cases with the previous approach.

The main drawback is in order to "deselect" a tile, I added a boolean in Cesium3DTile called selected. There's probably a better way to do this, but I was worried that modifying the selectedTiles array would cause a performance hit.

One final thing, I experimented with removing the tilesetContent flag because it doesn't serve much of a purpose anymore, except to speed up traversal slightly for those nodes. It works with or without it, but I kept it in for now.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 25, 2016

Thanks @lilleyse, this approach is good with me - and sounds cleaner.

@e-andersson do you want to do an initial review?

@lilleyse
Copy link
Contributor Author

Also just a note for reviewing, it's a lot clearer to look at 3cf51b5 alone.

@@ -367,13 +403,14 @@ define([
// zoomed into a neighborhood and can cull the skyscrapers in the root node.
//
// Don't select if the tile is being loaded to refine another tile
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment can be removed now, doesn't apply anymore

@e-andersson
Copy link
Contributor

This looks pretty good. No particular comments except for the those two comments above. The approach seems sound, but I haven't tried running it yet. (Will try it, but may not be able to get to it today.)

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 26, 2016

Thanks for the reivew, @e-andersson!

* @type {Array}
* @readonly
*/
this.descendantsWithContent = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps mention in the comment that this is computed at runtime, not loaded from tileset.json.

Also, as we discussed before, but now that you have more context, would it be useful for tileset.json to have any metadata for this, e.g., number of descendants with content?

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 don't think any metadata would help right now, unless it could link to those descendants directly, which doesn't seem possible.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 26, 2016

Do all the tests pass for you in this branch? They don't for me, but the failures are inconsistent. I think it is timing or my machine.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 26, 2016

That's all my comments.

@lilleyse
Copy link
Contributor Author

Do all the tests pass for you in this branch? They don't for me, but the failures are inconsistent. I think it is timing or my machine.

There were some failing tests that I just fixed, and one or two tests that don't seem related. The debugFreezeFrame test still fails because of the new selected bool in Cesium3DTileset being set to false automatically. I suppose Cesium3DTile could know if debugFreezeFrame is true and not set selected to false. In general I think the selected boolean is not great, and would rather do something else.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 26, 2016

We should fix these tests before merging. Perhaps instead of using a selected boolean, we can track the last frame number.

@lilleyse
Copy link
Contributor Author

I organized it differently such that debugFreezeFrame works correctly. The tests all pass now.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 26, 2016

JSHint fails:

Specs/Scene/Cesium3DTilesetSpec.js
  line 520  col 22  'root' is already defined.

@lilleyse
Copy link
Contributor Author

Oops. Fixed that.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 26, 2016

Looks good. Will also merge this into the doc branch now.

pjcozzi added a commit that referenced this pull request Jan 26, 2016
Fix replacement refinement with empty tiles
@pjcozzi pjcozzi merged commit 811f385 into 3d-tiles Jan 26, 2016
@pjcozzi pjcozzi deleted the fix-refining branch January 26, 2016 18:23
@e-andersson
Copy link
Contributor

@lilleyse Have you tested this in the viewer with some data, and if so, what data? It seems to me that we're back at the problem where blank space is shown when the tileset content tile is selected and has not yet loaded the json data. Have any other important changes to how the tileset metadata is handled been made? Perhaps I've missed something else, though looking at the spec I think our datasets are compliant.

On a side note, it seems the data (tileset2.json, tileset3.json) in Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/ are missing geometricError in the top level, which is marked required in the schema.

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