Cytopia
Cytopia copied to clipboard
Implement depth-first sorting algorithm for mapnodes
Currently the mapnodes are sorted by a Z-index. which works fairly well for 1x1 tiles. For multitile buildings, it's not possible to calculate a Z-index that will work. Instead, mapNodes should be sorted by a depth search.
I think it's safe to assume, that only the BUILDINGS layer will inhabit multitile buildings. We will still need a basic Z-Order for the overlapping terrain tiles. Worst case, we'll have two containers (with mapnode*) in two orders, and move the rendering to Map to render each layer.
I found this article: http://shaunlebron.github.io/IsometricBlocks/ Source Code: https://github.com/shaunlebron/IsometricBlocks
Hi, I'd like to help with this issue. But I found that current implementation doesn't use Z-index. Is it ture? And why there will has multiple buildings in one node?
I'm refactoring mapNode soon to help with this as preparation. I'll tell you when i'm done and we can discuss the details.
But I found that current implementation doesn't use Z-index This is true, nodes are ordered in "calculateVisibleNodes" in a for loop.