StarArawn / bevy_tiled

A plugin for rendering tiled maps.
MIT License
151 stars 40 forks source link

Remove TileMapChunk, do z transform in chunk Transform component instead #63

Closed Kurble closed 3 years ago

Kurble commented 3 years ago

This pull request attempts to fix the issue in #7, the actual work had been done already, so only the layer_id had to be removed.

Kurble commented 3 years ago

Ah, the marker is indeed convenient, that's a good point. The thing this PR addresses is that bevy will do a depth sort of all meshes based on their z component in view space, but it takes the z component from the transform. However, during rendering the tile_layer from TileMapChunk will override the z value in the pixel shader, which causes depth sorting (and therefor alpha blending) to behave incorrectly when using bevy_tiled along with other sprites.

dmtaub commented 3 years ago

Thanks for the explanation. I usually set my map to be way behind all my other sprites, so I never noticed. As long as it doesn’t break anything for others I’m happy to merge this — let’s just add an empty structure back as a marker.