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 a bug in QuadtreePrimitive.forEachLoadedTile #2155

Merged
merged 3 commits into from Sep 26, 2014
Merged

Conversation

kring
Copy link
Member

@kring kring commented Sep 26, 2014

When moving the camera around quickly, it is possible to end up with terrain tiles in the replacement queue that haven't had any loading done on them at all. That is, they're in the START state instead of the LOADING state. Specifically this happens when there are more tiles in the load queue than can be processed in the current frame.

This change makes it so such tiles are no longer returned by QuadtreePrimitive.forEachLoadedTile since they are (arguably) not actually loaded. This fixes a few crashes I saw in the wild, mostly when adding and removing layers, because code calling forEachLoadedTile wasn't expecting to to see tiles in the START state. Originally I was just going to fix the place that made this incorrect assumption, but after I fixed the third such place I realized I'd be better off just avoiding the problem entirely.

Fixes TerriaJS/nationalmap#358.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 26, 2014

Thanks @kring

pjcozzi added a commit that referenced this pull request Sep 26, 2014
Fix a bug in `QuadtreePrimitive.forEachLoadedTile`
@pjcozzi pjcozzi merged commit 27bbcbb into master Sep 26, 2014
@pjcozzi pjcozzi deleted the forEachLoadedTile branch September 26, 2014 12:03
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.

None yet

2 participants