Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
641 stars 73 forks source link

fix!: create IntGrid white-image on asset load and minimize its size #183

Closed Trouv closed 1 year ago

Trouv commented 1 year ago

Closes #172, and resolves an issue brought up by @Mattincho in #176

Summary

The white image generated for levels is now only used for intgrid coloring. This means it no longer needs to be the size of the level - it can just be the size of the maximum-sized intgrid layer. The maximum-sized intgrid tile is easy to determine during asset loading. This PR creates a small white-image for the maximum-sized intgrid tile once for the entire asset, rather than a large one once per level. This should improve performance, and also hopefully resolve issues with hitting hardware limits on larger levels.

BREAKING CHANGE: Most likely won't affect users - LdtkAsset has gained a int_grid_image_handle field, breaking any manual construction of it.

Mattincho commented 1 year ago

Tested the branch, and without enabling the atlas feature of bevy_ecs_tilemap, I can now load a level that doesn't work with main.