iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.1k stars 298 forks source link

Problem in tiles cleanup when adding a ColorLayer from a FileSource #1040

Closed zarov closed 5 years ago

zarov commented 5 years ago

Context

While working on improving FileSource and DataSourceProvider (#1033), I encountered some weird behavior, that is already present in iTowns. When adding a not tiled color layer (with FileSource), textures on affected tiles are badly cleaned and it results in a visual glitch (no texture at all on those tiles) that is only fixed when executing a view.notifyChange(view.tileLayer);.

I'm looking for a better way to fix this problem.

Steps to Reproduce

  1. use the globe_vector example
  2. remove the view.addLayer(gpxLayer); line
  3. run the example
  4. open the console, run view.addLayer(gpxLayer); and see the problem

Expected Behavior

The added layer should simply appear on top of the existing one. image

Actual Behavior

The added layer appears partially, and some of the existing one is not visible anymore. image

Possible Cause/Fix/Solution

Some ideas that could be looked into:

Overall, from what I understood while looking into it, it seems to come from when a layer is added and it is added on a node. After this, when logging things in LayeredMaterial, we can see that other layers (apart from the added one) are not present anymore in the material. Things have been disposed in TiledLayerGeometry#update, and commenting all ObjectRemovalHelper calls results in partially fixing the problem (but create others problems, so not a solution at all).

I don't know where I could continue looking, so if someone can led a hand, that would be great.

zarov commented 5 years ago

Issue resolved with #1033